Vscode: macOS: Add a setting to reopen last opened window after closing it

Created on 3 May 2017  路  23Comments  路  Source: microsoft/vscode

After updating to 1.11.2 I have been experiencing this issue that post restart of my Mac Sierra when I open code it start with an Untitled page.

Please let me know if any inputs are required on this ?

Danke,
Vishal

*out-of-scope feature-request workbench-state

Most helpful comment

@foo-baar I am not saying we as a team decide how it should be, we are just trying to follow macOS standard UX guidelines and I think in this case we found that it was more typical on macOS to not reopen a window when the user explicitly closed it (as opposed to quitting).

But it'll be better if users will have ability to configure that behavior

All 23 comments

@foo-baar What is the value of the following user setting: window.reopenFolders ?

Hello @kieferrm, here you go:
screen shot 2017-05-04 at 9 51 48 am

@foo-baar can you please describe the full scenario. I.e. Do you have a folder open when you close vscode? Do you have files open? Are they saved or unsaved? How do you launch vscode (terminal or dock)?

It's a general working scenario:
-> Working on a project, turned off vscode.
-> Shut down Mac Air Sierra (System Version: macOS 10.12.4 (16E195)
Kernel Version: Darwin 16.5.0)

-> Turn on machine again open vscode (launch from dock).
-> Vscode shows an new\untitled 1 page.

Please let me know if I should do a video recording too (馃構 just kidding).
Danke.

@foo-baar can you share the contents of your settings?

Hello @bpasero find it attached.

vscode.settings.docx
l)

@foo-baar if possible just copy and paste it into here

@bpasero :

  // Controls the font size in pixels.
  "editor.fontSize": 12,

  // Controls auto save of dirty files. Accepted values:  'off', 'afterDelay', 'onFocusChange' (editor loses focus), 'onWindowChange' (window loses focus). If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'.
  "files.autoSave": "off",

  // Controls the font family.
  "editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",

  // The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
  "editor.tabSize": 4,

  // Controls how the editor should render whitespace characters, possibilities are 'none', 'boundary', and 'all'. The 'boundary' option does not render single spaces between words.
  "editor.renderWhitespace": "none",

  // Configure glob patterns for excluding files and folders.
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/CVS": true,
    "**/.DS_Store": true
  },

  // Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'
  "editor.cursorStyle": "line",

  // Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
  "editor.insertSpaces": true,

  // Controls how lines should wrap. Can be:
  //  - 'off' (disable wrapping),
  //  - 'on' (viewport wrapping),
  //  - 'wordWrapColumn' (wrap at `editor.wordWrapColumn`) or
  //  - 'bounded' (wrap at minimum of viewport and `editor.wordWrapColumn`).
  "editor.wordWrap": "off",

  // Configure file associations to languages (e.g. "*.extension": "html"). These have precedence over the default associations of the languages installed.
  "files.associations": {}

}
,
{


  // Insert snippets when their prefix matches. Works best when 'quickSuggestions' aren't enabled.
  "editor.tabCompletion": false,

  // Controls the font family.
  "editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",

  // Controls the font weight.
  "editor.fontWeight": "normal",

  // Controls the font size in pixels.
  "editor.fontSize": 12,

  // Controls the line height. Use 0 to compute the lineHeight from the fontSize.
  "editor.lineHeight": 0,

  // Controls the display of line numbers. Possible values are 'on', 'off', and 'relative'. 'relative' shows the line count from the current cursor position.
  "editor.lineNumbers": "on",

  // Columns at which to show vertical rulers
  "editor.rulers": [],

  // Characters that will be used as word separators when doing word related navigations or operations
  "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?",

  // The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
  "editor.tabSize": 4,

  // Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
  "editor.insertSpaces": true,

  // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
  "editor.detectIndentation": true,

  // Controls if selections have rounded corners
  "editor.roundedSelection": true,

  // Controls if the editor will scroll beyond the last line
  "editor.scrollBeyondLastLine": true,

  // Controls if the minimap is shown
  "editor.minimap.enabled": false,

  // Render the actual characters on a line (as opposed to color blocks)
  "editor.minimap.renderCharacters": true,

  // Limit the width of the minimap to render at most a certain number of columns
  "editor.minimap.maxColumn": 120,

  // Controls how lines should wrap. Can be:
  //  - 'off' (disable wrapping),
  //  - 'on' (viewport wrapping),
  //  - 'wordWrapColumn' (wrap at `editor.wordWrapColumn`) or
  //  - 'bounded' (wrap at minimum of viewport and `editor.wordWrapColumn`).
  "editor.wordWrap": "off",

  // Controls the wrapping column of the editor when `editor.wordWrap` is 'wordWrapColumn' or 'bounded'.
  "editor.wordWrapColumn": 80,

  // Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.
  "editor.wrappingIndent": "same",

  // A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events
  "editor.mouseWheelScrollSensitivity": 1,

  // Controls if suggestions should automatically show up while typing
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": false
  },

  // Controls the delay in ms after which quick suggestions will show up
  "editor.quickSuggestionsDelay": 10,

  // Enables parameter hints
  "editor.parameterHints": true,

  // Controls if the editor should automatically close brackets after opening them
  "editor.autoClosingBrackets": true,

  // Controls if the editor should automatically format the line after typing
  "editor.formatOnType": false,

  // Controls if the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.
  "editor.formatOnPaste": false,

  // Controls if suggestions should automatically show up when typing trigger characters
  "editor.suggestOnTriggerCharacters": true,

  // Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
  "editor.acceptSuggestionOnEnter": true,

  // Controls if suggestions should be accepted on commit characters. For instance in JavaScript the semi-colon (';') can be a commit character that accepts a suggestion and types that character.
  "editor.acceptSuggestionOnCommitCharacter": true,

  // Controls whether snippets are shown with other suggestions and how they are sorted.
  "editor.snippetSuggestions": "bottom",

  // Controls whether copying without a selection copies the current line.
  "editor.emptySelectionClipboard": true,

  // Controls whether completions should be computed based on words in the document.
  "editor.wordBasedSuggestions": true,

  // Font size for the suggest widget
  "editor.suggestFontSize": 0,

  // Line height for the suggest widget
  "editor.suggestLineHeight": 0,

  // Controls whether the editor should highlight similar matches to the selection
  "editor.selectionHighlight": true,

  // Controls whether the editor should highlight semantic symbol occurrences
  "editor.occurrencesHighlight": true,

  // Controls the number of decorations that can show up at the same position in the overview ruler
  "editor.overviewRulerLanes": 3,

  // Controls if a border should be drawn around the overview ruler.
  "editor.overviewRulerBorder": true,

  // Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'
  "editor.cursorBlinking": "blink",

  // Zoom the font of the editor when using mouse wheel and holding Ctrl
  "editor.mouseWheelZoom": false,

  // Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'
  "editor.cursorStyle": "line",

  // Enables font ligatures
  "editor.fontLigatures": false,

  // Controls if the cursor should be hidden in the overview ruler.
  "editor.hideCursorInOverviewRuler": false,

  // Controls how the editor should render whitespace characters, possibilities are 'none', 'boundary', and 'all'. The 'boundary' option does not render single spaces between words.
  "editor.renderWhitespace": "none",

  // Controls whether the editor should render control characters
  "editor.renderControlCharacters": false,

  // Controls whether the editor should render indent guides
  "editor.renderIndentGuides": false,

  // Controls how the editor should render the current line highlight, possibilities are 'none', 'gutter', 'line', and 'all'.
  "editor.renderLineHighlight": "line",

  // Controls if the editor shows code lenses
  "editor.codeLens": true,

  // Controls whether the editor has code folding enabled
  "editor.folding": true,

  // Highlight matching brackets when one of them is selected.
  "editor.matchBrackets": true,

  // Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.
  "editor.glyphMargin": true,

  // Inserting and deleting whitespace follows tab stops
  "editor.useTabStops": true,

  // Remove trailing auto inserted whitespace
  "editor.trimAutoWhitespace": true,

  // Keep peek editors open even when double clicking their content or when hitting Escape.
  "editor.stablePeek": false,

  // Controls if the editor should allow to move selections via drag and drop.
  "editor.dragAndDrop": false,

  // Controls if the diff editor shows the diff side by side or inline
  "diffEditor.renderSideBySide": true,

  // Controls if the diff editor shows changes in leading or trailing whitespace as diffs
  "diffEditor.ignoreTrimWhitespace": true,

  // Controls if the diff editor shows +/- indicators for added/removed changes
  "diffEditor.renderIndicators": true,

  // Format a file on save. A formatter must be available, the file must not be auto-saved, and editor must not be shutting down.
  "editor.formatOnSave": false,


  // When enabled, emmet abbreviations are expanded when pressing TAB.
  "emmet.triggerExpansionOnTab": true,

  // Preferences used to modify behavior of some actions and resolvers of Emmet.
  "emmet.preferences": {},

  // Define profile for specified syntax or use your own profile with specific rules.
  "emmet.syntaxProfiles": {},

  // An array of languages where emmet abbreviations should not be expanded.
  "emmet.excludeLanguages": [
    "markdown"
  ],

  // Path to a folder containing emmet profiles, snippets and preferences
  "emmet.extensionsPath": null,


  // Controls if opened editors should show in tabs or not.
  "workbench.editor.showTabs": true,

  // Controls the position of the editor's tabs close buttons or disables them when set to 'off'.
  "workbench.editor.tabCloseButton": "right",

  // Controls if opened editors should show with an icon or not. This requires an icon theme to be enabled as well.
  "workbench.editor.showIcons": true,

  // Controls if opened editors show as preview. Preview editors are reused until they are kept (e.g. via double click or editing).
  "workbench.editor.enablePreview": true,

  // Controls if opened editors from Quick Open show as preview. Preview editors are reused until they are kept (e.g. via double click or editing).
  "workbench.editor.enablePreviewFromQuickOpen": true,

  // Controls where editors open. Select 'left' or 'right' to open editors to the left or right of the current active one. Select 'first' or 'last' to open editors independently from the currently active one.
  "workbench.editor.openPositioning": "right",

  // Controls if an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group.
  "workbench.editor.revealIfOpen": false,

  // Controls if Quick Open should close automatically once it loses focus.
  "workbench.quickOpen.closeOnFocusLost": true,

  // Controls if opening settings also opens an editor showing all default settings.
  "workbench.settings.openDefaultSettings": true,

  // Controls the location of the sidebar. It can either show on the left or right of the workbench.
  "workbench.sideBar.location": "left",

  // Controls the visibility of the status bar at the bottom of the workbench.
  "workbench.statusBar.visible": true,

  // Controls the visibility of the activity bar in the workbench.
  "workbench.activityBar.visible": true,

  // Controls if editors showing a file should close automatically when the file is deleted or renamed by some other process. Disabling this will keep the editor open as dirty on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data.
  "workbench.editor.closeOnFileDelete": true,

  // Navigate between open files using three-finger swipe horizontally.
  "workbench.editor.swipeToNavigate": false,

  // When enabled, will show the watermark tips when no editor is open.
  "workbench.tips.enabled": true,

  // When enabled, will show the Welcome page on startup.
  "workbench.welcome.enabled": true,

  // Specifies the color theme used in the workbench.
  "workbench.colorTheme": "Default Dark+",

  // Specifies the icon theme used in the workbench.
  "workbench.iconTheme": null,

  // Overrides colors from the currently selected color theme.
  "workbench.colorCustomizations": {},


  // Controls if files should open in a new window.
  // - default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)
  // - on: files will open in a new window
  // - off: files will open in the window with the files' folder open or the last active window
  // Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).
  "window.openFilesInNewWindow": "default",

  // Controls if folders should open in a new window or replace the last active window.
  // - default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)
  // - on: folders will open in a new window
  // - off: folders will replace the last active window
  // Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).
  "window.openFoldersInNewWindow": "default",

  // Controls how folders are being reopened after a restart. Select 'none' to never reopen a folder, 'one' to reopen the last folder you worked on or 'all' to reopen all folders of your last session.
  "window.reopenFolders": "one",

  // Controls if a window should restore to full screen mode if it was exited in full screen mode.
  "window.restoreFullscreen": false,

  // Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.
  "window.zoomLevel": 0,

  // Controls the window title based on the active editor. Variables are substituted based on the context:
  // ${activeEditorShort}: e.g. myFile.txt
  // ${activeEditorMedium}: e.g. myFolder/myFile.txt
  // ${activeEditorLong}: e.g. /Users/Development/myProject/myFolder/myFile.txt
  // ${rootName}: e.g. myProject
  // ${rootPath}: e.g. /Users/Development/myProject
  // ${appName}: e.g. VS Code
  // ${dirty}: a dirty indicator if the active editor is dirty
  // ${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values
  "window.title": "${activeEditorShort}${separator}${rootName}",

  // Controls the dimensions of opening a new window. By default, a new window will open in the center of the screen with small dimensions. When set to  'inherit', the window will get the same dimensions as the last active one. When set to 'maximized', the window will open maximized and fullscreen if configured to 'fullscreen'.
  "window.newWindowDimensions": "default",

@foo-baar thanks, these seem to be the default settings, but did you change any? The contents are showing on the right hand side when you open settings:

image

@bpasero : USER SETTINGS = 
// Place your settings in this file to overwrite the default settings
{
    "window.zoomLevel": 0,
    "editor.fontSize": 14,
    "files.autoSave": "afterDelay",
    "editor.renderWhitespace": "boundary",
    "terminal.integrated.fontSize": 14,
    "update.channel":"default",
    "workbench.iconTheme": "vscode-icons",
    "workbench.colorTheme": "Atom One Dark",
    "editor.wordWrap": "off",
    "workbench.welcome.enabled": false
}

Workspace setting:
// Place your settings in this file to overwrite default and user settings.
{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true
    }, 
    // Controls auto save of dirty files. Accepted values:  "off", "afterDelay", "onFocusChange". If set to "afterDelay" you can configure the delay in "files.autoSaveDelay".
    "files.autoSave": "afterDelay",
    "vsicons.presets.angular": true
}

@foo-baar does this reproduce for you when you just close VS Code and then start again? Do you really need to restart your OS to get this issue?

Hey @bpasero, right, so I tried to analyse the scenario in past few days, and here it is:

a. Working on some project, close vscode by pressing cmd+Q, open vscode again and it remember the last opened project.

b. Working on some project, close vscode by pressing CLOSE button on window (red icon on top left corner), open vscode again and it show untitled-1 page.

Behaviour stays the when you restart Mac.

Do let me know if you have any query on this.

Danke.

@foo-baar closing the window and then restarting we open up empty, this is expected and works as designed. Thanks for clarifying. I will update this issue.

@bpasero "closing the window and then restarting we open up empty" I don't think I understand the statement ? I am not closing the project, rather closing the vscode window.

@foo-baar you are on macOS right?

yup

@foo-baar there is a difference on macOS between quitting the app and closing the window:

  • quit app: restore the window and folder you opened
  • close window: the application is actually still running, just without any window, when you reopen we open up an empty window because we assume the previous window was of no more interest since you closed it

Does that make sense?

@bpasero From my perspective the behaviour should be consistent irrespective to method user chose to close vscode. But if thats what majority on team decided than should be it.

Thanks once again for following up.

@foo-baar I am not saying we as a team decide how it should be, we are just trying to follow macOS standard UX guidelines and I think in this case we found that it was more typical on macOS to not reopen a window when the user explicitly closed it (as opposed to quitting).

@bpasero Understand, makes sense too.

Any update on this? Driving me crazy. Closing the window with the application still "open" or running in the dock, and then reopening the window brings me to the default screen.

@foo-baar I am not saying we as a team decide how it should be, we are just trying to follow macOS standard UX guidelines and I think in this case we found that it was more typical on macOS to not reopen a window when the user explicitly closed it (as opposed to quitting).

But it'll be better if users will have ability to configure that behavior

We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

Was this page helpful?
0 / 5 - 0 ratings