Skip to content

Commit

Permalink
fixup! stash
Browse files Browse the repository at this point in the history
  • Loading branch information
garazdawi committed Oct 19, 2021
1 parent 0761a93 commit 90d26ce
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions apps/els_lsp/test/els_definition_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ type_application_remote(Config) ->
Def = els_client:definition(ExtraUri, 11, 38),
#{result := #{range := Range, uri := DefUri}} = Def,
?assertEqual(TypesUri, DefUri),
?assertEqual( els_protocol:range(#{from => {3, 7}, to => {3, 13}})
?assertEqual( els_protocol:range(#{from => {3, 1}, to => {3, 26}})
, Range),
ok.

Expand All @@ -431,7 +431,7 @@ type_application_user(Config) ->
Def = els_client:definition(Uri, 55, 25),
#{result := #{range := Range, uri := DefUri}} = Def,
?assertEqual(Uri, DefUri),
?assertEqual( els_protocol:range(#{from => {37, 7}, to => {37, 13}})
?assertEqual( els_protocol:range(#{from => {37, 1}, to => {37, 25}})
, Range),
ok.

Expand All @@ -441,7 +441,7 @@ type_export_entry(Config) ->
Def = els_client:definition(Uri, 9, 17),
#{result := #{range := Range, uri := DefUri}} = Def,
?assertEqual(Uri, DefUri),
?assertEqual( els_protocol:range(#{from => {37, 7}, to => {37, 13}})
?assertEqual( els_protocol:range(#{from => {37, 1}, to => {37, 25}})
, Range),
ok.

Expand Down Expand Up @@ -476,7 +476,7 @@ opaque_application_remote(Config) ->
Def = els_client:definition(ExtraUri, 16, 61),
#{result := #{range := Range, uri := DefUri}} = Def,
?assertEqual(TypesUri, DefUri),
?assertEqual( els_protocol:range(#{from => {7, 9}, to => {7, 22}})
?assertEqual( els_protocol:range(#{from => {7, 1}, to => {7, 35}})
, Range),
ok.

Expand All @@ -486,6 +486,6 @@ opaque_application_user(Config) ->
Def = els_client:definition(ExtraUri, 16, 24),
#{result := #{range := Range, uri := DefUri}} = Def,
?assertEqual(ExtraUri, DefUri),
?assertEqual( els_protocol:range(#{from => {20, 9}, to => {20, 21}})
?assertEqual( els_protocol:range(#{from => {20, 1}, to => {20, 34}})
, Range),
ok.
4 changes: 2 additions & 2 deletions apps/els_lsp/test/els_document_highlight_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ import_entry(Config) ->
type(Config) ->
Uri = ?config(code_navigation_uri, Config),
#{result := Locations} = els_client:document_highlight(Uri, 37, 9),
ExpectedLocations = [ #{range => #{from => {37, 7}, to => {37, 13}}}
ExpectedLocations = [ #{range => #{from => {37, 1}, to => {37, 25}}}
%% Should also include the usage, but does not
%%, #{range => #{from => {55, 23}, to => {55, 29}}}
],
Expand All @@ -284,7 +284,7 @@ type_application(Config) ->
opaque(Config) ->
Uri = ?config(code_navigation_types_uri, Config),
#{result := Locations} = els_client:document_highlight(Uri, 7, 9),
ExpectedLocations = [ #{range => #{from => {7, 9}, to => {7, 22}}}
ExpectedLocations = [ #{range => #{from => {7, 1}, to => {7, 35}}}
],
assert_locations(ExpectedLocations, Locations),
ok.
Expand Down
11 changes: 7 additions & 4 deletions apps/els_lsp/test/els_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ record_def_with_types(_Config) ->

Text3 = "-record(r1, {f1 :: t1(integer())}).",
?assertMatch([_], parse_find_pois(Text3, type_application, {t1, 1})),
%% No POI for builtin types like integer()
?assertMatch([#{id := {t1, 1}}], parse_find_pois(Text3, type_application)),
%% POI for builtin types like integer()
?assertMatch([#{id := {t1, 1}}, #{id := {erlang, integer, 0}} ],
parse_find_pois(Text3, type_application)),

Text4 = "-record(r1, {f1 :: m:t1(integer())}).",
?assertMatch([_], parse_find_pois(Text4, type_application, {m, t1, 1})),
Expand Down Expand Up @@ -181,7 +182,7 @@ assert_recursive_types(Text) ->
parse_find_pois(Text, record_field)),
?assertMatch([#{id := {m, t1, 1}},
#{id := {t2, 1}},
#{id := {t3, 0}}],
#{id := {t3, 0}} | _],
parse_find_pois(Text, type_application)),
ok.

Expand Down Expand Up @@ -225,7 +226,9 @@ type_name_macro(_Config) ->
%% Currently els_dodger cannot parse this type definition
%% Verify this does not prevent parsing following forms
Text = "-type ?M() -> integer() | t(). -spec f() -> any().",
?assertMatch({ok, [#{kind := spec, id := {f, 0}}]}, els_parser:parse(Text)),
?assertMatch({ok, [#{kind := spec, id := {f, 0}},
#{kind := type_application, id := {erlang, any, 0}}]},
els_parser:parse(Text)),
ok.

spec_name_macro(_Config) ->
Expand Down
8 changes: 4 additions & 4 deletions apps/els_lsp/test/els_references_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,14 @@ undefined_record_field(Config) ->
purge_references(_Config) ->
els_db:clear_tables(),
Uri = <<"file:///tmp/foo.erl">>,
Text0 = <<"-spec foo(integer()) -> ok.\nfoo(_X) -> ok.\nbar() -> foo(1).">>,
Text1 = <<"\n-spec foo(integer()) -> ok.\nfoo(_X)-> ok.\nbar() -> foo(1).">>,
Text0 = <<"-spec foo() -> ok.\nfoo(_X) -> ok.\nbar() -> foo().">>,
Text1 = <<"\n-spec foo() -> ok.\nfoo(_X)-> ok.\nbar() -> foo().">>,
Doc0 = els_dt_document:new(Uri, Text0),
Doc1 = els_dt_document:new(Uri, Text1),

ok = els_indexing:index(Uri, Text0, 'deep'),
?assertEqual({ok, [Doc0]}, els_dt_document:lookup(Uri)),
?assertEqual({ok, [#{ id => {foo, foo, 1}
?assertEqual({ok, [#{ id => {foo, foo, 0}
, range => #{from => {3, 10}, to => {3, 13}}
, uri => <<"file:///tmp/foo.erl">>
}]}
Expand All @@ -416,7 +416,7 @@ purge_references(_Config) ->

ok = els_indexing:index(Uri, Text1, 'deep'),
?assertEqual({ok, [Doc1]}, els_dt_document:lookup(Uri)),
?assertEqual({ok, [#{ id => {foo, foo, 1}
?assertEqual({ok, [#{ id => {foo, foo, 0}
, range => #{from => {4, 10}, to => {4, 13}}
, uri => <<"file:///tmp/foo.erl">>
}]}
Expand Down

0 comments on commit 90d26ce

Please sign in to comment.