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 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 }]