Closed
Description
Describe the bug
There are some corner cases in which the goto definition does not work for some macros:
- if ?MODULE is used as record name
- if a macro is used to define a case clause
To Reproduce
To reproduce, create two files:
test.erl
-module(test).
-export([test_function/0, test_function_2/0]).
-include("export.hrl").
-define(macro, 1).
-record(?MODULE, {
test :: #test_record{} %% GOTO Def Works
}).
-define(CASE(A, B),
V when V == A -> B).
test_function() ->
#?MODULE{}, %% GOTO Def Doesn't work
?macro, %% GOTO Def Works
#test_record{}, %% GOTO Def Works
ok.
test_function_2() ->
?macro, %% GOTO Def doesn't work
case 4 of
?CASE(4,5); %% GOTO Def doesn't work
_ -> 3
end.
and export.hrl
-record(test_record, {value}).
Expected behavior
GOTO definition should bring the cursor to the macro definitions.
Actual behavior
- Using GOTO Def on ?MODULE does not work at all
- If a case clause is defined with a macro like ?CASE(4,5), GOTO Def will not work anywhere in the function where ?CASE(4,5) is used
Context
erlang_ls
version (tag/sha): 0.0.27- Editor used: VS Code
- LSP client used: VS Code integrated LSP
Activity