Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit 97995ad

Browse files
amiraliescristianoc
authored andcommitted
Fix showing wrong argument for 0 arity constructors
1 parent 9857895 commit 97995ad

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/rescript-editor-support/Hover.re

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,18 @@ let newHover = (~rootUri, ~file: SharedTypes.file, ~getModule, loc) => {
150150
[typeString, docstring];
151151
| `Constructor({cname: {txt}, args}) =>
152152
let (typeString, docstring) = t |> fromType(~docstring);
153-
[
154-
typeString,
155-
Some(
156-
codeBlock(
157-
txt
158-
++ "("
159-
++ (
160-
args
161-
|> List.map(((t, _)) => {
162-
let typeString = t |> Shared.typeToString;
163-
typeString;
164-
})
165-
|> String.concat(", ")
166-
)
167-
++ ")",
168-
),
169-
),
170-
docstring,
171-
];
153+
154+
let argsString =
155+
switch (args) {
156+
| [] => ""
157+
| _ =>
158+
args
159+
|> List.map(((t, _)) => Shared.typeToString(t))
160+
|> String.concat(", ")
161+
|> Printf.sprintf("(%s)")
162+
};
163+
164+
[typeString, Some(codeBlock(txt ++ argsString)), docstring];
172165
| `Field({typ}) =>
173166
let (typeString, docstring) = typ |> fromType(~docstring);
174167
[typeString, docstring];

0 commit comments

Comments
 (0)