Search code examples
visual-studio-codetabs

In VS Code, how can I open the same file in multiple tabs of the same editor group?


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: enter image description here

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.


Solution

  • 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 (-: enter image description here

    Edit: this also requires you to put in settings.json

    "files.autoSave": "onFocusChange",