editor: Add select to {start,end} of larger syntax node commands#47571
Conversation
To accompany the move-to versions
|
We require contributors to sign our Contributor License Agreement, and we don't have @alexispurslane on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
|
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
Would y'all be open to a few more editing commands from Emacs that I miss? |
|
Can't promise anything, but feel free to open a discussion with the commands you have in mind and tag me. That way we can chat before you start implementing. General rule: if it's something a modern editor should have and the implementation is short and self-contained, it's likely to be accepted. |
Key changes: - Version bump v0.223 - Bold folder labels setting (zed-industries#47631) for project panel - min_size/max_size style methods in GPUI (zed-industries#47775) - Emoji typing fix (zed-industries#47835) - Heap allocation reductions in GPUI (zed-industries#47858) - Git graph: feature graph support (zed-industries#47861) - Editor: select to start/end of larger syntax node (zed-industries#47571) - Scroll position persistence moved to background with debounce (zed-industries#47834) - Markdown: improved double-click word selection (zed-industries#47844) - Language injections fix (zed-industries#46134) - SharedString::new_static for string literals (zed-industries#47865) - ACP registry improvements and agent deprecation banners Conflict resolutions: - Kept our version (0.0.1), not upstream's 0.223.0 - Removed vim settings from default.json, settings_content, settings_ui - Took upstream's bold_folder_labels in project panel - Removed deleted crate files (gpui, vim, util) Co-Authored-By: Claude Opus 4.6 <[email protected]>
I'm used to having the Emacs mark-sexp command, which selects/extends the selection to the start or end of a sexp/larger syntax node, so when I found out the
move to {start,end} of larger syntax nodecommands were added, these seemed like a natural addition; especially since most other commands in Zed seem to have movement and selection pairs, but those didn't really feel like they did.I did a really lot of tests (brainstormed ideas with GLM 4.7, then wrote the actual test case strings myself, then had it convert them to Rust, then made sure the tests made sense and passed), I'm not sure if it's too much or too little, but I looked at the PR that added the
move toversions of these commands and it was also +~550 lines, so this seemed in the ballpark 😅I factored out the core syntax node finding logic from those commands into a common function, so that both sets of commands could use it, just with different code for modifying the editor state wrapped around — mine just moves each selection's head, instead of totally resetting it.
Release Notes:
editor: select to start of larger syntax nodeandeditor: select to end of larger syntax node.