@@ -471,16 +471,16 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
471
471
setup do
472
472
text = """
473
473
defmodule MyModule do
474
- def add (a, b), do: a + b
474
+ def add_2_numbers (a, b), do: a + b
475
475
476
476
def dummy_function() do
477
- ad
478
- # ^
477
+ ad2n
478
+ # ^
479
479
end
480
480
end
481
481
"""
482
482
483
- % { text: text , location: { 4 , 6 } }
483
+ % { text: text , location: { 4 , 8 } }
484
484
end
485
485
486
486
test "setting 'signature_after_complete'" , context do
@@ -505,18 +505,18 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
505
505
opts = Keyword . merge ( @ supports , snippets_supported: false , signature_help_supported: false )
506
506
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , opts )
507
507
508
- assert item [ "insertText" ] == "add "
508
+ assert item [ "insertText" ] == "add_2_numbers "
509
509
assert item [ "command" ] == nil
510
510
511
511
opts =
512
512
Keyword . merge ( @ supports ,
513
513
snippets_supported: false ,
514
- locals_without_parens: MapSet . new ( add : 2 )
514
+ locals_without_parens: MapSet . new ( add_2_numbers : 2 )
515
515
)
516
516
517
517
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , opts )
518
518
519
- assert item [ "insertText" ] == "add "
519
+ assert item [ "insertText" ] == "add_2_numbers "
520
520
assert item [ "command" ] == @ signature_command
521
521
end
522
522
@@ -529,7 +529,7 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
529
529
opts = Keyword . merge ( @ supports , snippets_supported: false )
530
530
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , opts )
531
531
532
- assert item [ "insertText" ] == "add ("
532
+ assert item [ "insertText" ] == "add_2_numbers ("
533
533
assert item [ "command" ] == @ signature_command
534
534
end
535
535
@@ -542,7 +542,7 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
542
542
opts = Keyword . merge ( @ supports , signature_help_supported: false )
543
543
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , opts )
544
544
545
- assert item [ "insertText" ] == "add (${1:a}, ${2:b})"
545
+ assert item [ "insertText" ] == "add_2_numbers (${1:a}, ${2:b})"
546
546
assert item [ "command" ] == nil
547
547
end
548
548
@@ -554,50 +554,50 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
554
554
555
555
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , @ supports )
556
556
557
- assert item [ "insertText" ] == "add ($1)$0"
557
+ assert item [ "insertText" ] == "add_2_numbers ($1)$0"
558
558
assert item [ "command" ] == @ signature_command
559
559
end
560
560
561
561
test "with snippets/signature support, before valid arg, do not close parens" do
562
562
text = """
563
563
defmodule MyModule do
564
- def add (a, b), do: a + b
564
+ def add_2_numbers (a, b), do: a + b
565
565
566
566
def dummy_function() do
567
- ad100
568
- # ^
567
+ ad2n100
568
+ # ^
569
569
end
570
570
end
571
571
"""
572
572
573
- { line , char } = { 4 , 6 }
573
+ { line , char } = { 4 , 8 }
574
574
TestUtils . assert_has_cursor_char ( text , line , char )
575
575
576
576
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , @ supports )
577
577
578
- assert item [ "insertText" ] == "add ("
578
+ assert item [ "insertText" ] == "add_2_numbers ("
579
579
assert item [ "command" ] == @ signature_command
580
580
end
581
581
582
582
test "function in :locals_without_parens doesn't complete with args if there's text after cursor" do
583
583
text = """
584
584
defmodule MyModule do
585
- def add (a, b), do: a + b
585
+ def add_2_numbers (a, b), do: a + b
586
586
587
587
def dummy_function() do
588
- ad 100
589
- # ^
588
+ ad2n 100
589
+ # ^
590
590
end
591
591
end
592
592
"""
593
593
594
- { line , char } = { 4 , 6 }
594
+ { line , char } = { 4 , 8 }
595
595
TestUtils . assert_has_cursor_char ( text , line , char )
596
596
597
- opts = Keyword . merge ( @ supports , locals_without_parens: MapSet . new ( add : 2 ) )
597
+ opts = Keyword . merge ( @ supports , locals_without_parens: MapSet . new ( add_2_numbers : 2 ) )
598
598
{ :ok , % { "items" => [ item ] } } = Completion . completion ( text , line , char , opts )
599
599
600
- assert item [ "insertText" ] == "add "
600
+ assert item [ "insertText" ] == "add_2_numbers "
601
601
assert item [ "command" ] == @ signature_command
602
602
end
603
603
0 commit comments