Skip to content

Commit 394f437

Browse files
authored
Put cursor after pattern on field completion (#857)
* put cursor after pattern * changelog
1 parent 51b5ea6 commit 394f437

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
## master
1414

15+
#### :nail_care: Polish
16+
17+
- Change end position of cursor when completing `Some(<fieldName>)` in patterns. https://github.com/rescript-lang/rescript-vscode/pull/857
18+
1519
## 1.28.0
1620

1721
#### :bug: Bug Fix

analysis/src/CompletionBackEnd.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode
12751275
Completion.createWithSnippet
12761276
~name:("Some(" ^ fieldName ^ ")")
12771277
~kind:(kindFromInnerType t) ~env
1278-
~insertText:("Some(${1:" ^ fieldName ^ "})")
1278+
~insertText:("Some(" ^ fieldName ^ ")$0")
12791279
();
12801280
someAnyCase;
12811281
noneCase;

analysis/tests/src/expected/CompletionExpressions.res.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Path fnTakingRecord
196196
"tags": [],
197197
"detail": "otherRecord",
198198
"documentation": null,
199-
"insertText": "Some(${1:nested})",
199+
"insertText": "Some(nested)$0",
200200
"insertTextFormat": 2
201201
}, {
202202
"label": "Some(_)",
@@ -616,7 +616,7 @@ Path fnTakingRecordWithOptVariant
616616
"tags": [],
617617
"detail": "someVariant",
618618
"documentation": null,
619-
"insertText": "Some(${1:someVariant})",
619+
"insertText": "Some(someVariant)$0",
620620
"insertTextFormat": 2
621621
}, {
622622
"label": "Some(_)",

0 commit comments

Comments
 (0)