Skip to content

Commit cc0fc46

Browse files
committed
Clean up type vs docstring.
1 parent a05176b commit cc0fc46

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

analysis/src/Commands.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ let hover ~path ~line ~col ~currentFile ~debug =
4343
~forHover:true
4444
in
4545
match completions with
46-
| {kind = Label typString} :: _ ->
47-
Protocol.stringifyHover (Hover.codeBlock typString)
46+
| {kind = Label typString; docstring} :: _ ->
47+
let parts =
48+
(if typString = "" then [] else [Hover.codeBlock typString])
49+
@ docstring
50+
in
51+
Protocol.stringifyHover (String.concat "\n\n" parts)
4852
| _ -> (
4953
match CompletionBackEnd.completionsGetTypeEnv completions with
5054
| Some (typ, _env) ->

analysis/src/CompletionBackEnd.ml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,39 +1403,39 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
14031403
|> List.map mkLabel)
14041404
@ keyLabels
14051405
| Cdecorator prefix ->
1406-
let mkDecorator (name, doc) =
1407-
Completion.create ~name ~kind:(Label doc) ~env
1406+
let mkDecorator (name, docstring) =
1407+
{(Completion.create ~name ~kind:(Label "") ~env) with docstring}
14081408
in
14091409
[
1410-
("as", "");
1411-
("dead", "...docs for dead...");
1412-
("deriving", "");
1413-
("genType", "");
1414-
("genType.as", "");
1415-
("genType.import", "");
1416-
("genType.opaque", "");
1417-
("get", "");
1418-
("get_index", "");
1419-
("inline", "");
1420-
("int", "");
1421-
("live", "...docs for live...");
1422-
("meth", "");
1423-
("module", "");
1424-
("new", "");
1425-
("obj", "");
1426-
("react.component", "");
1427-
("return", "");
1428-
("scope", "");
1429-
("send", "");
1430-
("set", "");
1431-
("set_index", "");
1432-
("string", "");
1433-
("this", "");
1434-
("unboxed", "");
1435-
("uncurry", "");
1436-
("unwrap", "");
1437-
("val", "");
1438-
("variadic", "");
1410+
("as", []);
1411+
("dead", ["...docs for dead..."]);
1412+
("deriving", []);
1413+
("genType", []);
1414+
("genType.as", []);
1415+
("genType.import", []);
1416+
("genType.opaque", []);
1417+
("get", []);
1418+
("get_index", []);
1419+
("inline", []);
1420+
("int", []);
1421+
("live", ["...docs for live..."]);
1422+
("meth", []);
1423+
("module", []);
1424+
("new", []);
1425+
("obj", []);
1426+
("react.component", []);
1427+
("return", []);
1428+
("scope", []);
1429+
("send", []);
1430+
("set", []);
1431+
("set_index", []);
1432+
("string", []);
1433+
("this", []);
1434+
("unboxed", []);
1435+
("uncurry", []);
1436+
("unwrap", []);
1437+
("val", []);
1438+
("variadic", []);
14391439
]
14401440
|> List.filter (fun (decorator, _) -> Utils.startsWith decorator prefix)
14411441
|> List.map (fun (decorator, doc) ->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ Hover tests/src/Hover.res 112:3
6868
Nothing at that position. Now trying to use completion.
6969
Attribute id:live:[112:0->112:5] label:live
7070
Completable: Cdecorator(live)
71-
{"contents": "```rescript\n...docs for live...\n```"}
71+
{"contents": "...docs for live..."}
7272

0 commit comments

Comments
 (0)