Skip to content

Commit

Permalink
'index_references' added 'macro' and 'record', now they are also very…
Browse files Browse the repository at this point in the history
… fast
  • Loading branch information
shuying2244 committed Mar 11, 2024
1 parent 7b693c7 commit 54e334d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions apps/els_lsp/src/els_dt_document.erl
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ tokens_to_words([{string, _Location, String} | Tokens], Words) ->
_ ->
tokens_to_words(Tokens, Words)
end;
tokens_to_words([{var, _Location, Var} | Tokens], Words) ->
tokens_to_words(Tokens, sets:add_element(Var, Words));
tokens_to_words([{'?', _}, {var, _, Macro} | Tokens], Words) ->
tokens_to_words(Tokens, sets:add_element(Macro, Words));
tokens_to_words([_ | Tokens], Words) ->
Expand Down
4 changes: 2 additions & 2 deletions apps/els_lsp/src/els_references_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ find_references(Uri, #{
{F, A, _Index} = Id,
Key = {els_uri:module(Uri), F, A},
find_references_for_id(Kind, Key);
find_references(Uri, POI = #{kind := Kind}) when
find_references(_Uri, #{kind := Kind, id := Key}) when
Kind =:= record;
Kind =:= record_def_field;
Kind =:= define
->
find_scoped_references_for_def(Uri, POI);
find_references_for_id(Kind, Key);
find_references(Uri, Poi = #{kind := Kind, id := Id}) when
Kind =:= type_definition
->
Expand Down
4 changes: 2 additions & 2 deletions apps/els_lsp/src/els_text_search.erl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ extract_pattern({behaviour, Name}) ->
Name;
extract_pattern({atom, Name}) ->
Name;
extract_pattern({record_field, {_Record, Name}}) ->
Name;
extract_pattern({record_field, {Record, _Name}}) ->
Record;
extract_pattern({record, Name}) ->
Name.

Expand Down

0 comments on commit 54e334d

Please sign in to comment.