Reputation: 2159
When I do command + click in Visual Studio Code or right click and "go to definition", the file containing the definition opens in a new tab and I automatically see this file. So I change the view if the file containing the definition is another file.
Is it possible when I do this command to stay on the same file I was while still opening the other file in another tab?
Thank you for you answer.
Upvotes: 29
Views: 24412
Reputation: 2520
On mac, I can cmd + options + click
the target class/function to open in a new tab on the side. YMMV.
Upvotes: 9
Reputation: 149
You can also peek definition with Alt
+ F12
(be sure to highlight its symbol / invocation first).
This opens the definition in a smaller resizable tab (resizable down to ~4 lines of code) and allows editing if needed.
Example (source):
Upvotes: 4
Reputation: 141
Taken from: https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition
If a language supports it, you can go to the definition of a symbol by pressing F12.
If you press Ctrl and hover over a symbol, a preview of the declaration will appear.
Tip: You can jump to the definition with Ctrl+Click or open the definition to the side >with Ctrl+Alt+Click.
Upvotes: 2
Reputation: 31
Double clicking on the tab name also works if you don't want to disable preview feature of editor. Double clicked tab becomes persistent.
Upvotes: 3
Reputation: 1592
Preferences >> Settings >> Workbench >> Editor >> Enable Preview >> Uncheck/false
Upvotes: 40
Reputation: 1192
If you're capable to actually go to the definition you are looking for what is called the "Peek Definition". VS Code is highly customizable so how you have it configured it could do something different.
What I think you're looking for is Ctrl + Left Mouse Click or Alt + F12.
This should tell you more, VS Code Peek Definition
Upvotes: 9