Add actions to move to start and end of larger syntax node #45331
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.
Release Notes:
move_to_start_of_larger_syntax_nodeandmove_to_end_of_larger_syntax_nodethat move cursors to the start or end of the parent tree-sitter nodeFollowing up on my PR #41321, this PR only adds the actions that are used to enable code navigation across syntax nodes, without binding them to any keys (such as tab) by default. Both actions use the tree-sitter syntax tree to find parent nodes of the nodes the cursors are currently in.
move_to_start_of_larger_syntax_nodewill then move each cursor to the first position of the parent nodes whilemove_to_end_of_larger_syntax_nodeto a position right after the parent nodes.Related issues and discussions: #22349, #14803, #42828, #13736.
This PR doesn't achieve "tab out" functionality in the exact sense as is requested in these issues as it does not bind the actions to the tab key. I hope this PR can start some discussion on what the best way forward for these issues is. In the meantime, users can configure keys to use these actions as they see fit to emulate "tab out" behavior. For example,
This will enable tab to skip past code structures like brackets when the cursor is not in a snippet or the autocomplete menu is not open. At the same time, shift tab will act as a backup tab.