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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

## master

#### :nail_care: Polish

- Change end position of cursor when completing `Some(<fieldName>)` in patterns. https://github.com/rescript-lang/rescript-vscode/pull/857

## 1.28.0

#### :bug: Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion analysis/src/CompletionBackEnd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode
Completion.createWithSnippet
~name:("Some(" ^ fieldName ^ ")")
~kind:(kindFromInnerType t) ~env
~insertText:("Some(${1:" ^ fieldName ^ "})")
~insertText:("Some(" ^ fieldName ^ ")$0")
();
someAnyCase;
noneCase;
Expand Down
4 changes: 2 additions & 2 deletions analysis/tests/src/expected/CompletionExpressions.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Path fnTakingRecord
"tags": [],
"detail": "otherRecord",
"documentation": null,
"insertText": "Some(${1:nested})",
"insertText": "Some(nested)$0",
"insertTextFormat": 2
}, {
"label": "Some(_)",
Expand Down Expand Up @@ -616,7 +616,7 @@ Path fnTakingRecordWithOptVariant
"tags": [],
"detail": "someVariant",
"documentation": null,
"insertText": "Some(${1:someVariant})",
"insertText": "Some(someVariant)$0",
"insertTextFormat": 2
}, {
"label": "Some(_)",
Expand Down