File tree 2 files changed +24
-1
lines changed
test/elixir_sense/plugins 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ defmodule ElixirSense.Plugins.Option do
2
2
@ moduledoc false
3
3
4
4
alias ElixirSense.Plugins.Util
5
+ alias ElixirSense.Providers.Suggestion.Matcher
5
6
6
7
def find ( options , hint , fun ) do
7
8
for option <- options , match_hint? ( option , hint ) do
@@ -32,6 +33,6 @@ defmodule ElixirSense.Plugins.Option do
32
33
option
33
34
|> Map . fetch! ( :name )
34
35
|> to_string ( )
35
- |> String . starts_with ?( hint )
36
+ |> Matcher . match ?( hint )
36
37
end
37
38
end
Original file line number Diff line number Diff line change @@ -639,6 +639,28 @@ defmodule ElixirSense.Plugins.EctoTest do
639
639
"virtual"
640
640
]
641
641
end
642
+
643
+ test "at arg 2, suggest fuzzy field options" do
644
+ buffer = """
645
+ import Ecto.Schema
646
+ field :name, :string, deau
647
+ # ^
648
+ """
649
+
650
+ [ cursor ] = cursors ( buffer )
651
+ result = suggestions ( buffer , cursor )
652
+ assert Enum . map ( result , & & 1 . label ) == [ "default" ]
653
+
654
+ buffer = """
655
+ import Ecto.Schema
656
+ field :name, :string, pri_ke
657
+ # ^
658
+ """
659
+
660
+ [ cursor ] = cursors ( buffer )
661
+ result = suggestions ( buffer , cursor )
662
+ assert Enum . map ( result , & & 1 . label ) == [ "primary_key" ]
663
+ end
642
664
end
643
665
644
666
describe "suggestions for Ecto.Migration.add/3" do
You can’t perform that action at this time.
0 commit comments