Reputation: 500
I have two files open side by side like shown in the picture:
If I Ctrl+Click the function name two
in the left pane, I want VSCode to switch focus to already opened file second.py
in the right pane. Instead, VSCode opens file second.py
in a new tab in the current left pane (in a place indicated by red rectangle). Now you have three tabs instead of two, and first.py
is obscured from view.
How can I change this behavior so that VSCode focuses already opened tab, instead of opening a new, redundant tab?
Upvotes: 14
Views: 2003
Reputation: 620
I solved this in VS Code on windows by doing the following:
ctrl
+ p
> settings json
"window.openFilesInNewWindow": "off",
"workbench.editor.enablePreview": false
"workbench.editor.enablePreview": false"
means when you click a file it stays open. This is an optional part of this solution but I think it makes for a better DX.
"window.openFilesInNewWindow": "off"
means when you open a file it will focus the tab of that file if it is already open.
Upvotes: 3
Reputation: 381
Perhaps this wasn't available when the question was posted here but there's dedicated setting to do this now:
"workbench.editor.revealIfOpen": true
Upvotes: 23