@@ -295,21 +295,33 @@ defmodule NextLS.AutocompleteTest do
295295 ] } = expand ( runtime , ~c" Enum.count/" )
296296 end
297297
298- # TODO: locals
298+ test "operator completion" , % { runtime: runtime } do
299+ assert { :yes ,
300+ [
301+ % { arity: 1 , name: "+" , docs: _ , kind: :function } ,
302+ % { arity: 2 , name: "+" , docs: _ , kind: :function } ,
303+ % { arity: 2 , name: "++" , docs: _ , kind: :function }
304+ ] } = expand ( runtime , ~c" +" )
299305
300- # test "operator completion", %{runtime: runtime} do
301- # assert expand(runtime, ~c"+") == {:yes, ~c"", [~c"+/1", ~c"+/2", ~c"++/2"]}
302- # assert expand(runtime, ~c"+/") == {:yes, ~c"", [~c"+/1 ", ~c"+/2"]}
303- # assert expand(runtime, ~c"++/") == {:yes, ~c"", [~c"++/2"] }
304- # end
306+ assert { :yes ,
307+ [
308+ % { arity: 1 , name: "+ ", docs: _ , kind: :function } ,
309+ % { arity: 2 , name: "+" , docs: _ , kind: :function }
310+ ] } = expand ( runtime , ~c " +/ " )
305311
306- # test "sigil completion", %{runtime: runtime} do
307- # assert {:yes, ~c"", sigils} = expand(runtime, ~c"~")
308- # assert ~c"~C (sigil_C)" in sigils
309- # assert {:yes, ~c"", sigils} = expand(runtime, ~c"~r")
310- # assert ~c"\"" in sigils
311- # assert ~c"(" in sigils
312- # end
312+ assert { :yes ,
313+ [
314+ % { arity: 2 , name: "++" , docs: _ , kind: :function }
315+ ] } = expand ( runtime , ~c" ++/" )
316+ end
317+
318+ test "sigil completion" , % { runtime: runtime } do
319+ assert { :yes , sigils } = expand ( runtime , ~c" ~" )
320+ assert % { name: "C" , kind: :sigil } in sigils
321+ assert { :yes , ~c" " , sigils } = expand ( runtime , ~c" ~r" )
322+ assert ~c" \" " in sigils
323+ assert ~c" (" in sigils
324+ end
313325
314326 # TODO: maps
315327 # test "map atom key completion is supported", %{runtime: runtime} do
@@ -391,11 +403,16 @@ defmodule NextLS.AutocompleteTest do
391403 end )
392404 end
393405
394- # TODO: locals
395- # test "kernel import completion", %{runtime: runtime} do
396- # assert expand(runtime, ~c"defstru") == {:yes, ~c"ct", []}
397- # assert expand(runtime, ~c"put_") == {:yes, ~c"", [~c"put_elem/3", ~c"put_in/2", ~c"put_in/3"]}
398- # end
406+ test "kernel import completion" , % { runtime: runtime } do
407+ assert { :yes , [ % { name: "defstruct" , kind: :function , docs: _ , arity: 1 } ] } = expand ( runtime , ~c" defstru" )
408+
409+ assert { :yes ,
410+ [
411+ % { arity: 3 , name: "put_elem" , docs: _ , kind: :function } ,
412+ % { arity: 2 , name: "put_in" , docs: _ , kind: :function } ,
413+ % { arity: 3 , name: "put_in" , docs: _ , kind: :function }
414+ ] } = expand ( runtime , ~c" put_" )
415+ end
399416
400417 # TODO: this only partially works, will not say we support for now
401418 # test "variable name completion", %{runtime: runtime} do
0 commit comments