Home > front end >  Is it possible to quickly swap workspaces using the integrated terminal in Visual Studio Code?
Is it possible to quickly swap workspaces using the integrated terminal in Visual Studio Code?

Time:02-02

I would like to make it so that when I'm traversing directories using the integrated terminal, running code . opens the current working directory in the integrated terminal within the current VSCode window, "discarding"/closing the currently opened workspace, instead of opening a new window for that folder. Is this possible? If not, what would be a similar solution?

CodePudding user response:

As @ltomase found in their answer (and exanding on their answer), you can use the -r option of the code command. The doc comment for this option in the --help menu says this:

Force to open a file or folder in an already opened window.

There are other approaches not involving the command-line:

  1. Open command palette and use the File: Open Workspace from File... command to open workspace files (.code-workspace), or

  2. Open command palette and use the File: Open Folder... command to open folders (keyboard shortcut: ctrl K , ctrl o).

  3. Use alt f to open the File menu, then use keyboard navigation to go to "Open Recent" and then select a recent workspace to open.

CodePudding user response:

You can use code -r .

code --help gives the following description:
-r --reuse-window Force to open a file or folder in an already opened window.

Another source is Visual Studio Code Tips and Tricks

  • Related