-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "Go Last" #33715
Implement "Go Last" #33715
Conversation
@brandonbloom, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bpasero and @egamma to be potential reviewers. |
@brandonbloom, It will cover your contributions to all Microsoft-managed open source projects. |
@brandonbloom, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
@brandonbloom trying to understand the purpose of the command:
Is the idea that you just always remember the index of the last history operation by the user (either going forward or backward) so that you can jump back to that index? It is not clear to me how it would ever jump forward because once you go back and then navigate to another editor, the future history is lost. |
My goal is to implement a pair of vim commands that I use regularly: VSCodeVim/Vim#1993 I typically use the line-wise
And this to say about the
In these terms, both any cursor motion, including navigating forwards or backwards, counts as a "jump". You jump somewhere, and then tap VSCodeVim does not currently maintain its own "jump list", it relies on Code's navigation history. I implemented the simplest subset of the functionality I could think of, in the lowest risk way I could think of. That is: I just maintain the last place in history that you were. If there's any chance that last place is invalidated (such as when truncating history), you probably navigated somewhere, so "Navigate Back" is a reasonable thing to do. Does this explanation clear things up? |
|
@@ -368,6 +368,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousGroup, Fo | |||
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextGroup, FocusNextGroup.ID, FocusNextGroup.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.RightArrow) }), 'View: Focus Next Group', category); | |||
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateForwardAction, NavigateForwardAction.ID, NavigateForwardAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.RightArrow }, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_MINUS } }), 'Go Forward'); | |||
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateBackwardsAction, NavigateBackwardsAction.ID, NavigateBackwardsAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }), 'Go Back'); | |||
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateLastAction, NavigateLastAction.ID, NavigateLastAction.LABEL, { primary: null, win: null, mac: null, linux: null }), 'Go Last'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be written as:
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateLastAction, NavigateLastAction.ID, NavigateLastAction.LABEL), 'Go Last');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@brandonbloom can you also create an issue in VSCode repo so that we can resolve it with this PR. The issue best explains this feature so that it can be tested during end game (e.g. what is the expected behaviour). |
879df9d
to
eb9524f
Compare
Done. See #33902 |
Thanks 👍 |
This implements a "Go Last" command. This command will navigate either forward or backwards in history to the last entry in the history stack you were looking at. I've implemented this in service of implementing
''
and``
for vim mode: VSCodeVim/Vim#1089