Skip to content

Put cursor after pattern on field completion #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

zth
Copy link
Collaborator

@zth zth commented Dec 4, 2023

Small QoL improvement - in patterns you get completions for optional record fields, and one of the completions is "Some(theFieldName)". This is to make this type of pattern easy to insert via autocomplete: switch x { | {id: Some(id)} => id where Some(id) would be a completion item when completing at id: <com>.

Before this PR, the cursor would mark the contents of the the Some after insertion: Some(<cursor>id</cursor>). But, this is almost never what you want to do in this case, you almost always want to continue matching on other things. So, this, PR changes the position of the cursor after insertion to instead be after the full Some: Some(id)<cursor />.

@zth zth requested a review from cristianoc December 4, 2023 15:03
@zth zth merged commit 394f437 into master Dec 4, 2023
@zth zth deleted the pattern-field-completion-cursor-pos branch December 4, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants