Skip to content

Commit

Permalink
Merge pull request erlang-ls#887 from erlang-ls/886-limit-unused-macr…
Browse files Browse the repository at this point in the history
…o-detection-to-erl-files

[erlang-ls#886] Limit unused macro detection to .erl files
  • Loading branch information
robertoaloi committed Feb 2, 2021
2 parents 3764703 + f36a7dd commit 52d014a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/els_unused_macros_diagnostics.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ is_default() ->

-spec run(uri()) -> [els_diagnostics:diagnostic()].
run(Uri) ->
case els_dt_document:lookup(Uri) of
{ok, []} ->
[];
{ok, [Document|_]} ->
UnusedMacros = find_unused_macros(Document),
[make_diagnostic(POI) || POI <- UnusedMacros ]
case filename:extension(Uri) of
<<".erl">> ->
case els_dt_document:lookup(Uri) of
{ok, []} ->
[];
{ok, [Document|_]} ->
UnusedMacros = find_unused_macros(Document),
[make_diagnostic(POI) || POI <- UnusedMacros ]
end;
_ ->
[]
end.

-spec source() -> binary().
Expand Down

0 comments on commit 52d014a

Please sign in to comment.