Skip to content

editor: Add select to {start,end} of larger syntax node commands#47571

Merged
smitbarmase merged 1 commit intozed-industries:mainfrom
alexispurslane:select-to-larger-syntax-node
Jan 28, 2026
Merged

editor: Add select to {start,end} of larger syntax node commands#47571
smitbarmase merged 1 commit intozed-industries:mainfrom
alexispurslane:select-to-larger-syntax-node

Conversation

@alexispurslane
Copy link
Contributor

@alexispurslane alexispurslane commented Jan 25, 2026

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 node commands 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 to versions 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:

  • Added commands for extending selections to syntax node boundaries. i.e. editor: select to start of larger syntax node and editor: select to end of larger syntax node.

@cla-bot
Copy link

cla-bot bot commented Jan 25, 2026

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'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jan 25, 2026
@alexispurslane
Copy link
Contributor Author

You accepted this agreement at 1/24/2026, 8:42:41 PM

@alexispurslane
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 25, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@smitbarmase smitbarmase merged commit 03d8e9a into zed-industries:main Jan 28, 2026
37 checks passed
@alexispurslane
Copy link
Contributor Author

Thank you!

Would y'all be open to a few more editing commands from Emacs that I miss?

@smitbarmase
Copy link
Member

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.

naaiyy added a commit to Glass-HQ/Glass that referenced this pull request Feb 16, 2026
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 <noreply@anthropic.com>
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants