Skip to content

Commit

Permalink
更快的速度查找record的引用
Browse files Browse the repository at this point in the history
  • Loading branch information
shuying2244 committed Oct 24, 2024
1 parent 43206ff commit b4743cf
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 @@ -364,6 +364,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([{'-', _}, {atom, _, define}, {'(', _}, {var, _, Macro} | 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 @@ -98,12 +98,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 b4743cf

Please sign in to comment.