visual-studio-code

VSCode: Prevent file from opening in a new tab and instead focus to already opened tab in another pane


I have two files open side by side like shown in the picture:

Split panes.

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?


Solution

  • Perhaps this wasn't available when the question was posted here but there's dedicated setting to do this now:

    "workbench.editor.revealIfOpen": true