@@ -356,6 +356,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
356
356
# TODO
357
357
# test "list available bindings" do
358
358
# buffer = """
359
+ # defmodule Foo do
359
360
# import Ecto.Query
360
361
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.User, as: User
361
362
@@ -370,6 +371,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
370
371
# where: u.id == m
371
372
# # ^ ^
372
373
# end
374
+ # end
373
375
# """
374
376
375
377
# [cursor_1, cursor_2] = cursors(buffer)
@@ -390,6 +392,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
390
392
391
393
# test "list binding's fields" do
392
394
# buffer = """
395
+ # defmodule Foo do
393
396
# import Ecto.Query
394
397
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
395
398
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Comment
@@ -403,6 +406,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
403
406
# # ^ ^ ^ ^
404
407
# )
405
408
# end
409
+ # end
406
410
# """
407
411
408
412
# [cursor_1, cursor_2, cursor_3, cursor_4] = cursors(buffer)
@@ -429,6 +433,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
429
433
430
434
# test "list binding's fields even without any hint after `.`" do
431
435
# buffer = """
436
+ # defmodule Foo do
432
437
# import Ecto.Query
433
438
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
434
439
@@ -440,6 +445,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
440
445
# # ^
441
446
# )
442
447
# end
448
+ # end
443
449
# """
444
450
445
451
# [cursor] = cursors(buffer)
@@ -455,6 +461,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
455
461
456
462
test "list associations from assoc/2" do
457
463
buffer = """
464
+ defmodule Foo do
458
465
import Ecto.Query
459
466
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
460
467
@@ -465,6 +472,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
465
472
# ^
466
473
)
467
474
end
475
+ end
468
476
"""
469
477
470
478
[ cursor ] = cursors ( buffer )
@@ -492,6 +500,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
492
500
# Code.ensure_loaded(ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Tag)
493
501
494
502
# buffer = """
503
+ # defmodule Foo do
495
504
# import Ecto.Query
496
505
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
497
506
# alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Comment
@@ -500,6 +509,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
500
509
# from p in Post, join: c in Comment
501
510
# # ^ ^
502
511
# end
512
+ # end
503
513
# """
504
514
505
515
# [cursor_1, cursor_2] = cursors(buffer)
@@ -523,6 +533,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
523
533
524
534
test "list bindings and binding fields inside nested functions" do
525
535
buffer = """
536
+ defmodule Foo do
526
537
import Ecto.Query
527
538
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
528
539
@@ -533,6 +544,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
533
544
# ^ ^
534
545
)
535
546
end
547
+ end
536
548
"""
537
549
538
550
[ cursor_1 , cursor_2 ] = cursors ( buffer )
@@ -543,13 +555,15 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
543
555
544
556
test "list bindings and binding fields using full module name" do
545
557
buffer = """
558
+ defmodule Foo do
546
559
import Ecto.Query
547
560
548
561
def query() do
549
562
from p in ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post,
550
563
where: p.t
551
564
# ^ ^
552
565
end
566
+ end
553
567
"""
554
568
555
569
[ cursor_1 , cursor_2 ] = cursors ( buffer )
@@ -560,34 +574,39 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
560
574
561
575
test "from/2 without parens" do
562
576
buffer = """
577
+ defmodule Foo do
563
578
import Ecto.Query
564
579
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
565
580
566
581
def query() do
567
582
from p in Post, se
568
583
# ^
569
584
end
585
+ end
570
586
"""
571
587
572
588
[ cursor ] = cursors ( buffer )
573
589
574
590
assert [ % { label: "select" } , % { label: "select_merge" } ] = suggestions ( buffer , cursor )
575
591
576
592
buffer = """
593
+ defmodule Foo do
577
594
import Ecto.Query
578
595
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
579
596
580
597
def query() do
581
598
from p in Post, where: p.id
582
599
# ^
583
600
end
601
+ end
584
602
"""
585
603
586
604
[ cursor ] = cursors ( buffer )
587
605
588
606
assert [ % { label: "id" } ] = suggestions ( buffer , cursor )
589
607
590
608
buffer = """
609
+ defmodule Foo do
591
610
import Ecto.Query
592
611
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
593
612
@@ -597,13 +616,15 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
597
616
se
598
617
# ^
599
618
end
619
+ end
600
620
"""
601
621
602
622
[ cursor ] = cursors ( buffer )
603
623
604
624
assert [ % { label: "select" } , % { label: "select_merge" } ] = suggestions ( buffer , cursor )
605
625
606
626
buffer = """
627
+ defmodule Foo do
607
628
import Ecto.Query
608
629
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
609
630
@@ -613,6 +634,7 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
613
634
614
635
# ^
615
636
end
637
+ end
616
638
"""
617
639
618
640
[ cursor ] = cursors ( buffer )
@@ -622,13 +644,15 @@ defmodule ElixirLS.LanguageServer.Plugins.EctoTest do
622
644
623
645
test "succeeds when using schema with many_to_many assoc" do
624
646
buffer = """
647
+ defmodule Foo do
625
648
import Ecto.Query
626
649
alias ElixirLS.LanguageServer.Plugins.Ecto.FakeSchemas.Post
627
650
628
651
def query() do
629
652
from p in Post, se
630
653
# ^
631
654
end
655
+ end
632
656
"""
633
657
634
658
[ cursor ] = cursors ( buffer )
0 commit comments