From 6cf8985574f12d697203f957fc97f9e8b72b61e5 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 16 Aug 2023 15:29:30 +0200 Subject: [PATCH 1/2] fix accidental double pipe in exhaustive switch statements --- analysis/src/CompletionBackEnd.ml | 2 +- analysis/tests/src/expected/ExhaustiveSwitch.res.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 2cf5d183f..a510fb15a 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1672,7 +1672,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = ~cases: (v.constructors |> List.map (fun (constructor : polyVariantConstructor) -> - "| #" ^ constructor.name + "#" ^ constructor.name ^ match constructor.args with | [] -> "" diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 17b977cf9..96d3bc612 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -42,7 +42,7 @@ Path withSomePol "detail": "insert exhaustive switch for value", "documentation": null, "filterText": "withSomePoly", - "insertText": "withSomePoly {\n | | #one => ${1:failwith(\"todo\")}\n | | #three(_) => ${2:failwith(\"todo\")}\n | | #two => ${3:failwith(\"todo\")}\n }", + "insertText": "withSomePoly {\n | #one => ${1:failwith(\"todo\")}\n | #three(_) => ${2:failwith(\"todo\")}\n | #two => ${3:failwith(\"todo\")}\n }", "insertTextFormat": 2 }] From 76766b3a6b86d1c0b1f916241758ecc51686dfda Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 16 Aug 2023 15:30:56 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7af6ab1c..991238387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Fix invalid range for `definition`. https://github.com/rescript-lang/rescript-vscode/pull/781 - Don't emit object keys in uppercase as namespace. https://github.com/rescript-lang/rescript-vscode/pull/798 +- Fix accidental output of extra `|` when producing exhaustive switch code for polyvariants. https://github.com/rescript-lang/rescript-vscode/pull/805 ## 1.18.0