microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.86k stars 28.45k forks source link

Allow to open two distinct editors side by side in one group #36700

Open Neutrino-Sunset opened 6 years ago

Neutrino-Sunset commented 6 years ago

VsCode has the ability to horizonatally split an editor window. When you execute code --diff file1 file2 both files are opened side by side in a single editor window with a single header tab. A similar view is presented when you edit the VsCode settings.

This is splitting. It would be nice to be able to do this for my own files to have multiple views of the same file. What would make it actually usable would be the following three enhancements.

  1. The option to split either horizontally or vertically.
  2. The ability to move focus from one split pane to another.
  3. The ability to unsplit (revert the editor back to a single pane).

What we currently have is a keyboard shortcut "workbench.action.splitEditor" which doesn't actually split an editor at all, instead it just opens the same file in another editor in a different editor group. This is not editor splitting which by definition should occur in the same editor tab.

Calling opening a file in another editor group 'splitting' when there is already nascent functionality to support proper splitting is a pointless ambiguity that serves only to reduce the possibility that the editor will ever support proper splitting any time in the near future.

Proposal:

  1. Rename "workbench.action.splitEditor" to "workbench.action.openInNewEditorGroup"
  2. Make the VsCode diff view usable by adding a keyboard shortcut to permit cycling focus from one editor pane to the other.
  3. Add support to split open editor vertically or horizontally by the addition of the additional keyboard shortcuts "editor.action.splitHorizontal", "editor.action.splitVertical" and "editor.action.unsplit".
a-stewart commented 2 years ago

this is pretty much exactly what my extension "Workviews" (https://marketplace.visualstudio.com/items?itemName=agquick.workviews) does

I think that is slightly different to what is being asked for here. (The post above is a demo of what could be done with the functionality, not what we are asking for explicitly.)

This FR is asking for a way for extensions to control the "Split Editor in Group" functionality and specify what is rendered in the other half of the editor. At the moment it is not possible for extensions to do that.

thefakeplace commented 2 years ago

I think that is slightly different to what is being asked for here. (The post above is a demo of what could be done with the functionality, not what we are asking for explicitly.)

If you gather context from reading the thread, it's likely that most of the support for this FR is from Vim users who have a workflow based on grouping multiple editors within tabs. They've been punted here from other FR's that are closed as duplicates of this FR.

In my opinion, the main issue is that tabs don't group anything. One-to-one correlation between tabs and files, except in some special cases, like the diff view.

Creating another grid inside the existing editor grid seems like the wrong way to solve the problem to me-- especially if the new grid is subject to limitations like only horizontal splitting + showing the same file.

See #143024 for an alternate solution that solves everyone's problem.

starball5 commented 1 year ago

Related on Stack Overflow: Is it possible to create split editors inside individual tabs in VS Code?. I'll keep my answer post updated with whatever progress is made here.