16

I have VS Code 1.38.0.

I'm programming in C and I like working with files open side by side. Let's say I have a file "L" open on the left side and a file "R" open on the right side. If there is a function call in file L that is defined in file R, if I right-click on the function call and select "Go to Definition", a new tab with the file R will open on the left side and now I have file R open twice. What i want instead is for the already open file R to just go to the definition of the function. Is there any setting to enable that?

This behavior actually works when you have left panel only and multiple tabs but doesn't work if you have both left and right panel open.

stefanos
  • 163
  • 1
  • 6
  • 2
    Do the two opened instances have absolutely identical total paths, or do they differ on anything (even lower/upper-case)? – harrymc Sep 06 '19 at 13:51
  • Yes. I will right-click on a function in file A and select "Go to declaration". This will open the file where the function was declared. I will then drag that file on the right panel. Now if I right-click and Go to declaration on the same function on file A, it will open a new tab on the Left with the same file that is also on the Right – stefanos Sep 09 '19 at 06:45
  • You might get better answers on Github VScode. – harrymc Sep 09 '19 at 07:19
  • Alright, thank you. I'll give it a try :) – stefanos Sep 10 '19 at 08:04
  • 2
    The answer is to add this to your settings.json: "workbench.editor.revealIfOpen": true – Matt Miller Feb 06 '20 at 17:05

1 Answers1

20
"workbench.editor.revealIfOpen": true

This should do the work. It's a Setting in VSCode