Skip to content

Commit 3b03768

Browse files
committed
Sort cases
1 parent 8b074f7 commit 3b03768

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
22352235
let newText =
22362236
c.name ^ " {\n"
22372237
^ (cases
2238+
|> List.sort (String.compare)
22382239
|> List.mapi (fun index caseText ->
22392240
"| " ^ caseText ^ " => "
22402241
^ printFailwithStr (startIndex + index + 1))

tests/analysis_tests/tests/src/expected/ExhaustiveSwitch.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Path withSomePol
4040
"detail": "insert exhaustive switch for value",
4141
"documentation": null,
4242
"filterText": "withSomePoly",
43-
"insertText": "withSomePoly {\n | #\"switch\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #three(_) => ${3:failwith(\"todo\")}\n | #two => ${4:failwith(\"todo\")}\n | #\"exotic ident\" => ${5:failwith(\"todo\")}\n }",
43+
"insertText": "withSomePoly {\n | #\"exotic ident\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #\"switch\" => ${3:failwith(\"todo\")}\n | #three(_) => ${4:failwith(\"todo\")}\n | #two => ${5:failwith(\"todo\")}\n }",
4444
"insertTextFormat": 2
4545
}]
4646

tests/analysis_tests/tests/src/expected/Xform.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ TextDocumentEdit: Xform.res
242242
{"start": {"line": 101, "character": 2}, "end": {"line": 101, "character": 3}}
243243
newText:
244244
<--here
245-
#second | #"illegal identifier" | #third(_)
245+
#"illegal identifier" | #second | #third(_)
246246

247247
Xform src/Xform.res 107:4
248248
posCursor:[105:16] posNoWhite:[105:14] Found expr:[105:9->109:1]

0 commit comments

Comments
 (0)