Improve UX of let/let mut snippet cursor placement in block expressions - #23294
Open
mfroeh wants to merge 1 commit into
Open
Improve UX of let/let mut snippet cursor placement in block expressions#23294mfroeh wants to merge 1 commit into
mfroeh wants to merge 1 commit into
Conversation
A4-Tacks
reviewed
Sep 5, 2026
Member
There was a problem hiding this comment.
I once designed it like this, look: #19735 (comment)
Author
Ah interesting! |
Member
|
I don't know, but @Veykril |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Presently, the focus after navigating let/let mut snippets in block expressions ends up just before the semicolon inserted by the snippet.
When using clients that do not allow navigating over semicolons located to the right of the cursor by pressing
;(e.g. Zed), this leads to annoying UX, since if the user wants to continue editing after the let/let mut statement (arguably always in the next line), they cannot simply press Enter to end up on the next line.This PR addresses that by adding another snippet navigation stop after the semicolon, allowing the user to navigate past it as part of snippet expansion.
A potential downside with making this the default is if users have come to rely upon the snippet navigation having completed after navigating once. Clients may be within a "in_snippet" context, before users have navigated to $0 (e.g. Zed). Users could have configured their keybindings to function differently within this context, and may be surprised to still have the "in_snippet" behavior of their keybinding, after navigating within the let/let mut snippet once.
I hope this default behavior change can make it regardless, since I believe it improves upon UX, but I can understand if it doesn't, due to the issue laid out above.