Vscode: Mac: File -> Open should open in new window

Created on 20 Nov 2015  路  14Comments  路  Source: microsoft/vscode

On Mac, the standard behavior of the File -> Open menu is to open in a new window, but Visual Studio Code instead replaces the project in the current window with the new one. Achieving the standard Mac behavior requires first selecting File -> New Window before selecting File -> Open. Please instead make File -> Open follow the standard behavior.

feature-request

Most helpful comment

After spending some time to see how other applications handle this on Windows, macOS and Linux I decided to change the way window.openFilesInNewWindow works and also introduced a new setting window.openFoldersInNewWindow. These settings are not just a simple boolean but rather can have three values: on, off and default (the default). The reason why this setting cannot be just a boolean is that in some cases a file or folder will actually open in the same instance and in some cases it will not. By setting this to on you can force Code to open files and folders in new windows when using the File menu.

Quoting the description of the settings for the complete picture:

window.openFilesInNewWindow (macOS)

Controls if files should open in a new window or the last active window.

  • default: files will open in the last active window unless opened via the dock or from finder
  • on: files will open in a new window
  • off: files will open in 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 (Windows, Linux)

Controls if files should open in a new window or the last active window.

  • default: files will open in the last active window
  • on: files will open in a new window
  • off: files will open in 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

Controls if folders should open in a new window or 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 open in 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).

All 14 comments

+1

@rconnamacher @weinand would the same apply for "File > Open Recent"?

And also: Would you expect to open a new window when you pick a file vs. when you pick a folder?

  • Open Folder: opens a new window (as a new project)
  • Open File: opens a new window if the file is not part of any other open project
  • Open Recent: behaves like Open Folder or Open File.

Some Mac application support an alternative behaviour when the Alt-key is pressed. E.g. "Open Folder" could open the project in the current window.

@weinand thanks. I am open for suggestions how to name this setting :). I would add it to the "window" namespace where we currently have "window.reopenFolders" and "window.openFilesInNewWindow".

+1

Why not make it settable in user settings?

I would love to see this all configurable. I like the way sublime text does it. You can open a folder (which opens a new window) or open a file (which opens it in your current window). I never use "open recent". All doable with only the keyboard, of course (I've read about ctrl+click for your mousers, I guess). Though I can see why other people would want different things... thus making it configurable.

+1

+1

+1

I'd love to have that included!

+1

After spending some time to see how other applications handle this on Windows, macOS and Linux I decided to change the way window.openFilesInNewWindow works and also introduced a new setting window.openFoldersInNewWindow. These settings are not just a simple boolean but rather can have three values: on, off and default (the default). The reason why this setting cannot be just a boolean is that in some cases a file or folder will actually open in the same instance and in some cases it will not. By setting this to on you can force Code to open files and folders in new windows when using the File menu.

Quoting the description of the settings for the complete picture:

window.openFilesInNewWindow (macOS)

Controls if files should open in a new window or the last active window.

  • default: files will open in the last active window unless opened via the dock or from finder
  • on: files will open in a new window
  • off: files will open in 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 (Windows, Linux)

Controls if files should open in a new window or the last active window.

  • default: files will open in the last active window
  • on: files will open in a new window
  • off: files will open in 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

Controls if folders should open in a new window or 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 open in 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).
Was this page helpful?
0 / 5 - 0 ratings