Skip to content

Commit d2b8a9b

Browse files
committed
Hover on labels in function application.
1 parent 1bfd9b4 commit d2b8a9b

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,5 +1476,6 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
14761476
in
14771477
labels
14781478
|> List.filter (fun (name, _t) ->
1479-
Utils.startsWith name prefix && not (List.mem name identsSeen))
1479+
Utils.startsWith name prefix
1480+
&& (forHover || not (List.mem name identsSeen)))
14801481
|> List.map mkLabel

analysis/tests/src/Completion.res

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,7 @@ let _ = <div name="" />
348348
// ^hov
349349

350350
// let _ = FAO.forAutoObject["age"]
351-
// ^hov
351+
// ^hov
352+
353+
// let _ = ff(~opt1=3)
354+
// ^hov

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,3 +1360,19 @@ Pexp_ident FAO.forAutoObject:[349:11->349:28]
13601360
Completable: Cpath Value[FAO, forAutoObject]
13611361
{"contents": "```rescript\n{\"age\": int, \"forAutoLabel\": FAR.forAutoRecord}\n```"}
13621362

1363+
Hover tests/src/Completion.res 352:17
1364+
Nothing at that position. Now trying to use completion.
1365+
posCursor:[352:17] posNoWhite:[352:16] Found expr:[352:11->352:22]
1366+
Pexp_apply ...[352:11->352:13] (~opt1352:15->352:19=...[352:20->352:21])
1367+
Completable: CnamedArg(Value[ff], opt1, [opt1])
1368+
Found type for function (
1369+
~opt1: int=?,
1370+
~a: int,
1371+
~b: int,
1372+
unit,
1373+
~opt2: int=?,
1374+
unit,
1375+
~c: int,
1376+
) => int
1377+
{"contents": "```rescript\noption<int>\n```"}
1378+

0 commit comments

Comments
 (0)