Reputation: 21465
Sometimes I want to open the same file multiple tabs, each tab focusing on a different line/method, in Eclipse this is easy, but I haven't found a way to do it in VS Code? screenshot from Eclipse doing it:
Split view isn't enough, right now I'm on a 14" laptop with no extra display available, the laptop screen is too small to comfortably use split view.
Upvotes: 13
Views: 4959
Reputation: 21465
Since Microsoft has no plans to implement the feature request, an alternative solution is to create a symlink of the file: ln -s code.c code.ln.c
and have *.ln.c
in .git/info/exclude
then VSCode threats them as 2 different files, even though editing 1 of them is instantly reflected in the second (-:
Edit: this also requires you to put in settings.json
"files.autoSave": "onFocusChange",
Upvotes: 2
Reputation: 53
On the latest VSCODE version at this moment, v 1.84.2, there is an easy way to open two instances of a file side by side to compare different parts of the content, for example two methods that achieve the same result.
In the vscode explorer open a file as usual, just double clicking on it, then rigth click over the same file on vscode explorer and pick "Open to the Side" menu or alternativelly press Ctrl + Enter.
You will have two tabs with independent vertical scroll to compare different parts of the content.
Upvotes: -1
Reputation: 379
There is a clunky workaround in the feature request:
Some links with visual guide to achieve this:
https://www.mytecbits.com/microsoft/dot-net/compare-contents-of-two-files-in-vs-code https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_diffs
P.S. This workaround however can only open 2 tabs of the same file concurrently within the same tab group
Upvotes: 6
Reputation: 184
You can do this by Split Editor
feature in VS Code.
Check the following image for details.
Upvotes: 0
Reputation: 20237
I don't know if there is another solution, but this should work: Right click on the tab and then select Split [Up|Down|Left|Right]:
Upvotes: -2