Skip to content

Commit 483be76

Browse files
committed
sort text
1 parent 2c6b7c4 commit 483be76

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,12 +2299,8 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
22992299
in which we send it. This fixes that by providing a sort text making the typed completions
23002300
guaranteed to end up on top. *)
23012301
items
2302-
|> List.mapi (fun index (c : Completion.t) ->
2303-
{
2304-
c with
2305-
sortText =
2306-
Some ("A" ^ string_of_int (index + 1) ^ " " ^ c.name);
2307-
})
2302+
|> List.map (fun (c : Completion.t) ->
2303+
{c with sortText = Some ("A" ^ " " ^ c.name)})
23082304
else items
23092305
in
23102306
items @ regularCompletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)=O->recordField(vari
233233
"tags": [],
234234
"detail": "One\n\ntype someVariant = One | Two | Three(int, string)",
235235
"documentation": null,
236-
"sortText": "A1 One",
236+
"sortText": "A One",
237237
"insertText": "One",
238238
"insertTextFormat": 2
239239
}, {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Completable: Cexpression CArgument Value[someFn](~isOn)=t
2626
"tags": [],
2727
"detail": "bool",
2828
"documentation": null,
29-
"sortText": "A1 true"
29+
"sortText": "A true"
3030
}, {
3131
"label": "tLocalVar",
3232
"kind": 12,
@@ -127,7 +127,7 @@ Completable: Cexpression CArgument Value[someFnTakingVariant](~config)=O
127127
"tags": [],
128128
"detail": "One\n\ntype someVariant = One | Two | Three(int, string)",
129129
"documentation": null,
130-
"sortText": "A1 One",
130+
"sortText": "A One",
131131
"insertText": "One",
132132
"insertTextFormat": 2
133133
}, {
@@ -160,7 +160,7 @@ Completable: Cexpression CArgument Value[someFnTakingVariant]($0)=So
160160
"tags": [],
161161
"detail": "someVariant",
162162
"documentation": null,
163-
"sortText": "A1 Some(_)",
163+
"sortText": "A Some(_)",
164164
"insertText": "Some(${1:_})",
165165
"insertTextFormat": 2
166166
}, {
@@ -181,7 +181,7 @@ Completable: Cexpression CArgument Value[someFnTakingVariant](~configOpt2)=O
181181
"tags": [],
182182
"detail": "One\n\ntype someVariant = One | Two | Three(int, string)",
183183
"documentation": null,
184-
"sortText": "A1 One",
184+
"sortText": "A One",
185185
"insertText": "One",
186186
"insertTextFormat": 2
187187
}, {
@@ -249,7 +249,7 @@ Completable: Cexpression CArgument Value[someOtherFn]($2)=t
249249
"tags": [],
250250
"detail": "bool",
251251
"documentation": null,
252-
"sortText": "A1 true"
252+
"sortText": "A true"
253253
}, {
254254
"label": "tLocalVar",
255255
"kind": 12,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] test=T
3838
"tags": [],
3939
"detail": "Two\n\ntype testVariant = One | Two | Three(int)",
4040
"documentation": null,
41-
"sortText": "A1 Two",
41+
"sortText": "A Two",
4242
"insertText": "Two",
4343
"insertTextFormat": 2
4444
}, {
@@ -47,7 +47,7 @@ Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] test=T
4747
"tags": [],
4848
"detail": "Three(int)\n\ntype testVariant = One | Two | Three(int)",
4949
"documentation": null,
50-
"sortText": "A2 Three(_)",
50+
"sortText": "A Three(_)",
5151
"insertText": "Three(${1:_})",
5252
"insertTextFormat": 2
5353
}, {

0 commit comments

Comments
 (0)