Skip to content

Add actions to move to start and end of larger syntax node#45331

Merged
ConradIrwin merged 1 commit intozed-industries:mainfrom
vamsi10010:treesitter-node-actions
Jan 14, 2026
Merged

Add actions to move to start and end of larger syntax node#45331
ConradIrwin merged 1 commit intozed-industries:mainfrom
vamsi10010:treesitter-node-actions

Conversation

@vamsi10010
Copy link
Contributor

@vamsi10010 vamsi10010 commented Dec 19, 2025

Release Notes:

  • Added two actions move_to_start_of_larger_syntax_node and move_to_end_of_larger_syntax_node that move cursors to the start or end of the parent tree-sitter node

Following 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_node will then move each cursor to the first position of the parent nodes while move_to_end_of_larger_syntax_node to 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,

"context": "Editor && vim_mode == insert && !in_snippet && !showing_completions",
"bindings": {
  "tab": "editor::MoveToEndOfLargerSyntaxNode",
  "shift-tab": "editor::Tab"
}

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.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 19, 2025
@vamsi10010 vamsi10010 force-pushed the treesitter-node-actions branch from d1eb42f to 4493c5e Compare December 20, 2025 00:48
@vamsi10010 vamsi10010 marked this pull request as ready for review December 20, 2025 00:54
@vamsi10010 vamsi10010 force-pushed the treesitter-node-actions branch from 4493c5e to 47031be Compare December 20, 2025 16:51
@vamsi10010
Copy link
Contributor Author

@ConradIrwin, I took your feedback and made this PR with just the actions. Would appreciate it if you could take a look!

@vamsi10010 vamsi10010 force-pushed the treesitter-node-actions branch from e28c66a to 29e1345 Compare January 13, 2026 21:04
@ConradIrwin ConradIrwin merged commit b8fd09e into zed-industries:main Jan 14, 2026
23 checks passed
@ConradIrwin
Copy link
Member

Thanks!

1 similar comment
@tonyrav3n
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants