@@ -29,7 +29,7 @@ defmodule NextLS.SignatureHelpTest do
2929
3030 File . write! ( imported , """
3131 defmodule Imported do
32- def boom(boom1, _boom2) do
32+ def boom([] = boom1, _boom2) do
3333 boom1
3434 end
3535 end
@@ -40,12 +40,22 @@ defmodule NextLS.SignatureHelpTest do
4040 File . write! ( bar , """
4141 defmodule Bar do
4242 def run() do
43- Remote.bang!()
43+ Remote.bang!("!" )
4444 end
4545 end
4646 """ )
4747
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 ]
4959 end
5060
5161 setup :with_lsp
@@ -63,56 +73,49 @@ defmodule NextLS.SignatureHelpTest do
6373 id: 4 ,
6474 jsonrpc: "2.0" ,
6575 params: % {
66- position: % { line: 3 , character: 16 } ,
76+ position: % { line: 2 , character: 13 } ,
6777 textDocument: % { uri: uri }
6878 }
6979 } )
7080
7181 assert_result 4 , % {
72- "activeParameter" => 0 ,
73- "activeSignature" => 0 ,
7482 "signatures" => [
7583 % {
76- "activeParameter" => 0 ,
7784 "parameters" => [
7885 % { "label" => "bang" }
7986 ] ,
80- "documentation" => "need help" ,
81- "label" => "bang!"
87+ "label" => "bang!(bang)"
8288 }
8389 ]
8490 }
8591 end
8692
87- test "get signature help 2" , % { client: client , bar: bar } = context do
93+ test "get signature help 2" , % { client: client , baz: baz } = context do
8894 assert :ok == notify ( client , % { method: "initialized" , jsonrpc: "2.0" , params: % { } } )
8995
9096 assert_is_ready ( context , "my_proj" )
9197 assert_notification "$/progress" , % { "value" => % { "kind" => "end" , "message" => "Finished indexing!" } }
9298
93- uri = uri ( bar )
99+ uri = uri ( baz )
94100
95101 request ( client , % {
96102 method: "textDocument/signatureHelp" ,
97103 id: 4 ,
98104 jsonrpc: "2.0" ,
99105 params: % {
100- position: % { line: 8 , character: 10 } ,
106+ position: % { line: 2 , character: 13 } ,
101107 textDocument: % { uri: uri }
102108 }
103109 } )
104110
105111 assert_result 4 , % {
106- "activeParameter" => 0 ,
107- "activeSignature" => 0 ,
108112 "signatures" => [
109113 % {
110- "activeParameter" => 0 ,
111114 "parameters" => [
112- % { "label" => "bang" }
115+ % { "label" => "[] = boom1" } ,
116+ % { "label" => "_boom2" }
113117 ] ,
114- "documentation" => "need help" ,
115- "label" => "bang!"
118+ "label" => "boom([] = boom1, _boom2)"
116119 }
117120 ]
118121 }
0 commit comments