From 9793dd29ee63c793c218f7743a7dfb22f1b57959 Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Thu, 23 May 2024 09:30:03 -0400 Subject: [PATCH] fix(index): better heuristic if a reference is from a macro (#499) In Elixir >= 1.17, the meta will _not_ have a `:column` key if it is generated by a macro. --- priv/monkey/_next_ls_private_compiler.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/priv/monkey/_next_ls_private_compiler.ex b/priv/monkey/_next_ls_private_compiler.ex index 7864281d..d6bce866 100644 --- a/priv/monkey/_next_ls_private_compiler.ex +++ b/priv/monkey/_next_ls_private_compiler.ex @@ -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