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?
Perhaps this wasn't available when the question was posted here but there's dedicated setting to do this now:
"workbench.editor.revealIfOpen": true
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With