Skip to content

Commit

Permalink
fix(index): better heuristic if a reference is from a macro
Browse files Browse the repository at this point in the history
In Elixir >= 1.17, the meta will _not_ have a `:column` key if it is
generated by a macro.
  • Loading branch information
mhanberg committed May 23, 2024
1 parent 5846724 commit f114686
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion priv/monkey/_next_ls_private_compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,14 @@ defmodule NextLSPrivate.Tracer do
def trace({type, meta, module, func, arity}, env) when type in [:remote_function, :remote_macro, :imported_macro] do
parent = parent_pid()

if type == :remote_macro && meta[:closing][:line] != meta[:line] do
condition =
if Version.match?(System.version(), ">= 1.17.0-dev") do
is_nil(meta[:column])
else
type == :remote_macro && meta[:closing][:line] != meta[:line]
end

if condition do
# this is the case that a macro is getting expanded from inside
# another macro expansion
:noop
Expand Down

0 comments on commit f114686

Please sign in to comment.