@@ -29,7 +29,7 @@ defmodule NextLS.SignatureHelpTest do
29
29
30
30
File . write! ( imported , """
31
31
defmodule Imported do
32
- def boom(boom1, _boom2) do
32
+ def boom([] = boom1, _boom2) do
33
33
boom1
34
34
end
35
35
end
@@ -40,12 +40,22 @@ defmodule NextLS.SignatureHelpTest do
40
40
File . write! ( bar , """
41
41
defmodule Bar do
42
42
def run() do
43
- Remote.bang!()
43
+ Remote.bang!("!" )
44
44
end
45
45
end
46
46
""" )
47
47
48
- [ bar: bar , imported: imported , remote: remote ]
48
+ baz = Path . join ( cwd , "my_proj/lib/baz.ex" )
49
+
50
+ File . write! ( baz , """
51
+ defmodule Baz do
52
+ def run() do
53
+ Imported.boom([1, 2], 1)
54
+ end
55
+ end
56
+ """ )
57
+
58
+ [ bar: bar , imported: imported , remote: remote , baz: baz ]
49
59
end
50
60
51
61
setup :with_lsp
@@ -63,56 +73,49 @@ defmodule NextLS.SignatureHelpTest do
63
73
id: 4 ,
64
74
jsonrpc: "2.0" ,
65
75
params: % {
66
- position: % { line: 3 , character: 16 } ,
76
+ position: % { line: 2 , character: 13 } ,
67
77
textDocument: % { uri: uri }
68
78
}
69
79
} )
70
80
71
81
assert_result 4 , % {
72
- "activeParameter" => 0 ,
73
- "activeSignature" => 0 ,
74
82
"signatures" => [
75
83
% {
76
- "activeParameter" => 0 ,
77
84
"parameters" => [
78
85
% { "label" => "bang" }
79
86
] ,
80
- "documentation" => "need help" ,
81
- "label" => "bang!"
87
+ "label" => "bang!(bang)"
82
88
}
83
89
]
84
90
}
85
91
end
86
92
87
- test "get signature help 2" , % { client: client , bar: bar } = context do
93
+ test "get signature help 2" , % { client: client , baz: baz } = context do
88
94
assert :ok == notify ( client , % { method: "initialized" , jsonrpc: "2.0" , params: % { } } )
89
95
90
96
assert_is_ready ( context , "my_proj" )
91
97
assert_notification "$/progress" , % { "value" => % { "kind" => "end" , "message" => "Finished indexing!" } }
92
98
93
- uri = uri ( bar )
99
+ uri = uri ( baz )
94
100
95
101
request ( client , % {
96
102
method: "textDocument/signatureHelp" ,
97
103
id: 4 ,
98
104
jsonrpc: "2.0" ,
99
105
params: % {
100
- position: % { line: 8 , character: 10 } ,
106
+ position: % { line: 2 , character: 13 } ,
101
107
textDocument: % { uri: uri }
102
108
}
103
109
} )
104
110
105
111
assert_result 4 , % {
106
- "activeParameter" => 0 ,
107
- "activeSignature" => 0 ,
108
112
"signatures" => [
109
113
% {
110
- "activeParameter" => 0 ,
111
114
"parameters" => [
112
- % { "label" => "bang" }
115
+ % { "label" => "[] = boom1" } ,
116
+ % { "label" => "_boom2" }
113
117
] ,
114
- "documentation" => "need help" ,
115
- "label" => "bang!"
118
+ "label" => "boom([] = boom1, _boom2)"
116
119
}
117
120
]
118
121
}
0 commit comments