Change editor.action.focusNextCursor to reveal the primary cursor instead of all cursors #182148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #182147
Previously this command (and
editor.action.focusPreviousCursor
, introduced in #145909) calledIViewModel.revealPrimaryCursor
which in turn calledCursorsController.revealPrimary
. However, those names are deceptive.revealPrimary
actually reveals all cursors. There are cases where revealing the primary cursor and not all cursors is desirable, such as commands dedicated to changing the primary cursor.To support this I've renamed the existing "reveal primary" functions to "reveal all" and added a proper "reveal primary". I then updated
editor.action.focusNextCursor
andfocusPreviousCursor
to use the new "reveal primary" function.All other commands that used "reveal primary" now use "reveal all" which is just a rename and they have the same behavior they had before.
Before:
After:
I audited the other uses of
IViewModel.revealPrimaryCursor
to determine if they want to reveal all cursors or the primary cursor.These all remove secondary cursors, resulting in a single cursor so it doesn't matter what they use
BaseMoveToCommand
TopCommand
BottomCommand
CancelSelection
RemoveSecondaryCursors
These each make sense to "reveal all". No single cursor has a strong priority over others
CursorMoveImpl
CursorMoveBasedCommand
HomeCommand
EndCommand
LineStartCommand
LineEndCommand
ExpandLineSelectionAction
These probably want to reveal the most recently added cursor, but that concept doesn't currently exist.
WordCommand
LineCommand
LineCommand
doesn't work properly with multiple cursors anyway, so it's currently a bit moot.