Skip to content

Commit 68a820f

Browse files
authored
Merge pull request #214 from Lucccyo/sig_help_looping_parameter
Signature help should not loop over the parameters once it is finished
2 parents 468e4b8 + fdd6950 commit 68a820f

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/frontend/query_commands.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,11 @@ let dispatch pipeline (type a) : a Query_protocol.t -> a = function
10681068
in
10691069
match application_signature with
10701070
| Some s ->
1071+
(* The signature help should not appear on the name of the function. *)
10711072
if Msource.compare_position source position s.function_position < 0 then
10721073
None
1074+
(* The signature help should not appear after the last parameter. *)
1075+
else if s.active_param = None then None
10731076
else
10741077
let prefix =
10751078
let fun_name = Option.value ~default:"_" s.function_name in
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
$ $MERLIN single signature-help -position 2:14 <<EOF
2+
> let f x y z = x + y + z
3+
> let a = f 4 4
4+
> EOF
5+
{
6+
"class": "return",
7+
"value": {
8+
"signatures": [
9+
{
10+
"label": "f : int -> int -> int -> int",
11+
"parameters": [
12+
{
13+
"label": [
14+
4,
15+
7
16+
]
17+
},
18+
{
19+
"label": [
20+
11,
21+
14
22+
]
23+
},
24+
{
25+
"label": [
26+
18,
27+
21
28+
]
29+
}
30+
]
31+
}
32+
],
33+
"activeParameter": 2,
34+
"activeSignature": 0
35+
},
36+
"notifications": []
37+
}
38+
39+
$ $MERLIN single signature-help -position 2:16 <<EOF
40+
> let f x y z = x + y + z
41+
> let a = f 4 4 4
42+
> EOF
43+
{
44+
"class": "return",
45+
"value": {},
46+
"notifications": []
47+
}

0 commit comments

Comments
 (0)