File tree 5 files changed +21
-11
lines changed
5 files changed +21
-11
lines changed Original file line number Diff line number Diff line change 16
16
- Expand type aliases in hovers. https://github.com/rescript-lang/rescript-vscode/pull/881
17
17
- Include fields when completing a braced expr that's an ID, where it the path likely starts with a module. https://github.com/rescript-lang/rescript-vscode/pull/882
18
18
- Complete domProps for lowercase JSX components from ` ReactDOM.domProps ` if possible. https://github.com/rescript-lang/rescript-vscode/pull/883
19
+ - Do not emit ` _ ` when completing in patterns. https://github.com/rescript-lang/rescript-vscode/pull/885
19
20
20
21
## 1.32.0
21
22
Original file line number Diff line number Diff line change @@ -1204,6 +1204,11 @@ type completionMode = Pattern of Completable.patternMode | Expression
1204
1204
1205
1205
let rec completeTypedValue ~full ~prefix ~completionContext ~mode
1206
1206
(t : SharedTypes.completionType ) =
1207
+ let emptyCase num =
1208
+ match mode with
1209
+ | Expression -> " $" ^ string_of_int (num - 1 )
1210
+ | Pattern _ -> " ${" ^ string_of_int num ^ " :_}"
1211
+ in
1207
1212
match t with
1208
1213
| Tbool env ->
1209
1214
[
@@ -1278,7 +1283,9 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode
1278
1283
let noneCase = Completion. create " None" ~kind: (kindFromInnerType t) ~env in
1279
1284
let someAnyCase =
1280
1285
Completion. createWithSnippet ~name: " Some(_)" ~kind: (kindFromInnerType t)
1281
- ~env ~insert Text:" Some(${1:_})" ()
1286
+ ~env
1287
+ ~insert Text:(Printf. sprintf " Some(%s)" (emptyCase 1 ))
1288
+ ()
1282
1289
in
1283
1290
let completions =
1284
1291
match completionContext with
@@ -1338,11 +1345,13 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode
1338
1345
in
1339
1346
let okAnyCase =
1340
1347
Completion. createWithSnippet ~name: " Ok(_)" ~kind: (Value okType) ~env
1341
- ~insert Text:" Ok(${1:_})" ()
1348
+ ~insert Text:(Printf. sprintf " Ok(%s)" (emptyCase 1 ))
1349
+ ()
1342
1350
in
1343
1351
let errorAnyCase =
1344
1352
Completion. createWithSnippet ~name: " Error(_)" ~kind: (Value errorType) ~env
1345
- ~insert Text:" Error(${1:_})" ()
1353
+ ~insert Text:(Printf. sprintf " Error(%s)" (emptyCase 1 ))
1354
+ ()
1346
1355
in
1347
1356
let completions =
1348
1357
match completionContext with
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ Path fnTakingRecord
204
204
"tags": [],
205
205
"detail": "otherRecord",
206
206
"documentation": null,
207
- "insertText": "Some(${1:_} )",
207
+ "insertText": "Some($0 )",
208
208
"insertTextFormat": 2
209
209
}, {
210
210
"label": "None",
@@ -411,7 +411,7 @@ Path fnTakingArray
411
411
"tags": [],
412
412
"detail": "bool",
413
413
"documentation": null,
414
- "insertText": "Some(${1:_} )",
414
+ "insertText": "Some($0 )",
415
415
"insertTextFormat": 2
416
416
}, {
417
417
"label": "Some(true)",
@@ -488,7 +488,7 @@ Path fnTakingArray
488
488
"tags": [],
489
489
"detail": "bool",
490
490
"documentation": null,
491
- "insertText": "Some(${1:_} )",
491
+ "insertText": "Some($0 )",
492
492
"insertTextFormat": 2
493
493
}, {
494
494
"label": "Some(true)",
@@ -525,7 +525,7 @@ Path fnTakingArray
525
525
"tags": [],
526
526
"detail": "bool",
527
527
"documentation": null,
528
- "insertText": "Some(${1:_} )",
528
+ "insertText": "Some($0 )",
529
529
"insertTextFormat": 2
530
530
}, {
531
531
"label": "Some(true)",
@@ -624,7 +624,7 @@ Path fnTakingRecordWithOptVariant
624
624
"tags": [],
625
625
"detail": "someVariant",
626
626
"documentation": null,
627
- "insertText": "Some(${1:_} )",
627
+ "insertText": "Some($0 )",
628
628
"insertTextFormat": 2
629
629
}, {
630
630
"label": "None",
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ Path someFnTakingVariant
201
201
"detail": "someVariant",
202
202
"documentation": null,
203
203
"sortText": "A Some(_)",
204
- "insertText": "Some(${1:_} )",
204
+ "insertText": "Some($0 )",
205
205
"insertTextFormat": 2
206
206
}, {
207
207
"label": "Sort",
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ Path someTuple
188
188
"tags": [],
189
189
"detail": "bool",
190
190
"documentation": null,
191
- "insertText": "Some(${1:_} )",
191
+ "insertText": "Some($0 )",
192
192
"insertTextFormat": 2
193
193
}, {
194
194
"label": "Some(true)",
@@ -224,7 +224,7 @@ Path someVariant
224
224
"tags": [],
225
225
"detail": "type someVariant = One | Two(bool)",
226
226
"documentation": null,
227
- "insertText": "Some(${1:_} )",
227
+ "insertText": "Some($0 )",
228
228
"insertTextFormat": 2
229
229
}, {
230
230
"label": "Some(One)",
You can’t perform that action at this time.
0 commit comments