Currently the navigation history is global for all editor groups. Pressing alt-left and alt-right jumps from group to group. It would be helpful to have an option to navigate within the history of each group separately. This is useful when editing same file in multiple groups, and preserving view in one group while actively navigating through another.
An example of text editor that behaves as described here is jEdit (through navigator plugin )
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
Happy Coding!
The issue is not duplicate of #36634 and shall be re-opened:
Sorry, I am new to VS code, so looks like I did not use correct terminology. From introduction materials I got impression that vs code uses term "Editor" for a single pane that is created by pressing "Split Editor" button on top right corner of active pane. But in order to close such pane the command is "Close all editors in group". So it seems the correct term to use to describe requested functionality is "Group of Editors". I updated the description using this terminology. Again, this is not a dup of #36634, please reopen.
Yeah agreed.
I have been looking for this feature for quite some time, but this is the first I've seen an issue about it. I'd absolutely love to see this make it in an upcoming release. I used to use Qt Creator before switching to VSCode and used the navigate within editor group function all the time. I really miss not having it in VSCode.
I recently switched from Qt Creator to VS Code due to better jumping to definitions, speed and memory usage. The experience of trying to navigate within a single editor group and instead jumping to unwanted files in another split window is frustrating. I often have to give up and resort to manual scrolling through tabs in search of the right file, because the history of navigation within a group gets cut off from a moment you did some work in another split editor.
Just to clarify: this is about "Go Back" and "Go Forward" which supports in-editor navigation (as opposed to the actions that allow to navigate across editors).
Wouldn't this require a history stack per editor group to get right?
That is correct @bpasero. For further clarification, here are the steps to visualize the problem, using C++:
Expected:
The right editor should go back to main.cpp (the "Go Back" command may need to be repeated a few times, but it should get there eventually), the left editor should be unchanged. The cursor should never jump to the left editor during this navigation.
Actual:
The cursor jumps to the left editor. Upon further invocations of "Go Back", it goes back to main.cpp in the left editor. When "Go Forward" is used a few times, you come back to the right editor, but it's not possible to navigate to main.cpp in the right editor using "Go Back" and "Go Forward".
Ok makes sense, I have updated the title. To be clear: there are commands to navigate in-group or across all groups, however what is missing is a in-editor navigation scoped to an editor group.
I have exactly the same experience as @ArekPiekarz coming from other editors, most of all Qt Creator. (And thanks for posting how to reproduce the issue!) I'd say the inability to navigate within a single editor group is the one major issue I have with VS Code, and it irritates me on a daily basis. If this were fixed then it'd quickly become my favorite editor.
Well, that, and also lack of command with shortcut to switch to previous file in the editor (i.e. without backtracking the history). I've got very used to this workflow while using jEdit. Switched to VSC almost year but still swear every time when hit history back key and get thrown into place I have no interest viewing.
@briankendall with Qt creator, when you navigate, does it simply switch between editors or does it record locations inside the editor too and navigates between them?
@vldmrrr
Well, that, and also lack of command with shortcut to switch to previous file in the editor
Previous editor in sequential order or most recently used? There is Ctrl+Tab, did you try?
In Qt Creator it tracks locations inside each editor group. It's basically the same functionality that we have in VS Code that we have today, except that when you navigate backwards it will:
Most recently used in the group. Ctrl+Tab does seem to work although sometimes it jumps in unpredictable (to me at least) way. Just now I tried in two adjacent group switching using the key while changing focus between left and right, and at one point in the left group it all of a sudden switched to the most recent file from right group. And now it cycles like this:
Ctrl+Tab in the same scenario on the last step just jumps the focus to the right group (which is showing file 1) instead of showing file 2 in left.With these inconsistencies I started to use "Go to file..." exclusively. But this is really off topic in current issue
@vldmrrr Ctrl+Tab will only navigate in editors of the active group, anything else would be a bug that you should report individually if you can record steps how to reproduce from a fresh install (e.g. using --user-data-dir <new dir> to rule out any settings that could have an impact).
@montaguk and does each "editor group" have its own individual history of edit locations? Or is the history global and simply scoped to the editor group you are in.
@bpasero I'm not sure what the difference is between those two things. However I'm pretty sure the answer is that each editor group has its own individual history of edit locations. @montaguk please correct me if I'm wrong.
@briankendall @bpasero - Correct, there is a separate navigation history per editor group.
I think the desired behavior could be demonstrated currently by opening two separate instances of vscode in the same workspace/directory, each with only one editor group. Navigating in one instance has no impact on the history of the other instance. Going back/forward in one instance only "pops" the state from that particular group's navigation history.
Related: https://github.com/microsoft/vscode/issues/36634 but for a history scoped to the editor only.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Has anyone written an extension that implements this functionality?
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Has anyone worked on authoring a PR for this? If not, I'd willing to give it a shot sometime soon. In that case I'm interested in whether someone can point me towards the parts of the codebase that would likely be involved in implementing this fix.
This seems to be also connected with #9526. In Vim/Emacs history jump stack can be configured up to small details and the common workflow is to usually restrict the stack to each dedicated split (or "group" in VSCode).
In my case, when I'm studying codebases I usually tend to have 2-4 different splits opened in my text editor. Usually, I would dedicate each split to different code sections (potentially even within the same file), some of which could be somehow connected with each other. Then, I would normally jump between these splits, studying the related to each section code, while also traversing back and forth through the dedicated to each split the jump history. This workflow allows me to more quickly grasp unknown codebases.
For the mentioned workflow, the way how VSCode works right now is very disorienting and frustrating on a day-to-day basis, so please, consider addressing the related issues rather sooner, than way later.
Totally agreed with @Wetlize and @ArekPiekarz, i don't use this feature when i have multiple views of same files. But when using such navigation in multi-group workspace i always get many duplicated tabs on various groups after some time.
Most helpful comment
That is correct @bpasero. For further clarification, here are the steps to visualize the problem, using C++:
Expected:
The right editor should go back to main.cpp (the "Go Back" command may need to be repeated a few times, but it should get there eventually), the left editor should be unchanged. The cursor should never jump to the left editor during this navigation.
Actual:
The cursor jumps to the left editor. Upon further invocations of "Go Back", it goes back to main.cpp in the left editor. When "Go Forward" is used a few times, you come back to the right editor, but it's not possible to navigate to main.cpp in the right editor using "Go Back" and "Go Forward".