Search code examples
visual-studio-codemultiple-monitors

Visual Studio Code - Tabs (editors) of the same project in multiple screens


Using multiple screens I normally place multiple classes (files) in different screens, this helps me a lot while refactoring, checking tests and comparing changes. Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor. I checked the documentation and plugins, but the only way I found, is to open two windows, pointing to the same project (folder) and put those in different screens. I don't like this solution, that causes also some problem when I watch code changes using TypeScript.

Any suggestion?

I use Windows 10, latest version of VSCode.

UPDATE: the feature is currently available in VSCode Insider, and will be released in the next stable version. I will update this once that happen. See the answer below for more details.


Solution

  • A solution is to press CTRL+K and after releasing CTRL, press O.

    This will open the current file in a new window.

    There are few things I don't like about this solution:

    • Drag and Drop does not work
    • Create a new instance of VS Code resulting in (for me) 180MB of ram used
    • To open the file it takes to me few seconds (quite slow)
    • The file remains open in the original window as well

    Update 20/03/2019:

    There is a feature request you can track here:

    https://github.com/Microsoft/vscode/issues/10121

    And an explanation about why this is difficult to implement here:

    https://github.com/Microsoft/vscode/issues/10121#issuecomment-345770248


    Update 20/03/2019:

    Another important side effect highlighted by @Mär is that:

    the IntelliSense fails to establish references it had when the file was opened in the window, where the entire project is opened


    Update 07/11/2023:

    VSCode Insider has the beta version of this feature, it works very well and does what we need. According to the team it will be released with the next stable version of VSCode.

    Here is the official GitHub link: https://github.com/microsoft/vscode/issues/10121#issuecomment-1790316086

    To try it out, until it is released, download VSCode Insider here: https://code.visualstudio.com/insiders/

    Once in use CTRL+SHIFT+P to access the actions dialogue, and select "Move Active Editor into a New Window". I suggest you bind a keyboard shortcut to it for an easy access.


    Update 05/20/2024:

    This feature is now avaible siince version 1.85.x : https://github.com/microsoft/vscode/issues/10121#issuecomment-1836212530