Reputation: 420
I recently started using Visual Studio Code and I would like to know, is a way to open files in a new tab? Currently whenever I open a new file the files I currently have open disappear. I say new tab, but any option that will let me open a new file in the same window as the old one works.
I have tried disabling Preview Mode through the workbench settings as shown in this answer: How to config vscode to open files always in a new tab?. However, when I choose Open or Open Recent the new file still replaces my old file.
Thanks.
Upvotes: 12
Views: 15456
Reputation: 1324248
Starting with VSCode 1.52 (Nov. 2020), you should not have any more issue: all files will open in new tabs, even in preview mode.
Better handling of preview editors:
Preview editors are now better handled with numerous improvements based on feedback and making this feature work more consistent.
The setting
workbench.editor.enablePreviewFromQuickOpen
is now disabled by default so that editors opening from quick open will not appear in preview mode anymore.When you start a navigation (e.g. go to definition), the editor you start from will move out of preview mode to keep it open while the new editor will be in preview mode until you navigate further.
We changed all of our custom trees (the ones used from extensions or Git changes view for example) to work more consistently like our built-in trees (like the explorer).
This means, the following interactions now apply to all of them:
- double-click or mouse-middle-click to open non-preview
- Enter to open non-preview (Space to open in preview-mode)
Note: if you are the author of an extension that is leveraging our custom tree API, you can benefit from this change as well.
Make sure to usevscode.open
orvscode.diff
commands for theTreeItem.command
and you are in!A new menu item in the editor overflow menu allows to quickly turn off preview editors altogether:
Upvotes: 2
Reputation: 1093
This is likely due to Visual Studio Code opening file in what's called "Preview Mode", which allows you to quickly view files, ideally if a tab is in Preview Mode then its title in the tab bar, will be italic.
To disable Preview Mode set "workbench.editor.enablePreview": false in your settings file or use the "workbench.editor.enablePreviewFromQuickOpen" option to disable it only from the quick open menu.
Alternatively, use command palette CTL+Shift+P (to get all settings) VScode settings then in User => Workbench => Editor Management you can uncheck Enable Preview and Enable Preview from Quick Open to get the same results described above
Upvotes: 2
Reputation: 51
For 1.21.1 version.
In user settings =>
"workbench.editor.enablePreview": false, "workbench.editor.enablePreviewFromQuickOpen"
the best way i found.
Upvotes: 5
Reputation: 420
Thanks everyone. Double clicking and dragging was useful, but it still didn't solve my problem when opening files from different projects with the "Open File" menu command. I found that Multi-root Workspaces is what I was looking for. https://code.visualstudio.com/docs/editor/multi-root-workspaces
Upvotes: 0
Reputation: 431
Once you have to open your settings file, add the "workbench.editor.enablePreview" property and set value to false.
Upvotes: 13
Reputation: 709
Upvotes: 2