erlang-language-platform icon indicating copy to clipboard operation
erlang-language-platform copied to clipboard

Can not rename macro name and type.

Open JimMoen opened this issue 9 months ago • 1 comments

Describe the bug

Cannot rename macros define and type define by calling lsp-rename. But renaming variables and functions works fine.

To Reproduce**

-module(hello).

-define(test_macro, an_atom).
-define(test_macro(V), {?test_macro, V}).

-type(some_type() :: string()).

-export([print/0]).

-spec print() -> ok.
print() ->
    Str = "Hello, world!",
    _ = ?test_macro,
    _ = ?test_macro("hello"),
    io:format(Str).


-spec print(some_type()) -> ok.
print(Str) ->
    io:format(Str).

For a simple erl file like the one above, placing the cursor on the print/0 function or the Str variable and renaming it to print_2/0 and Str1 will work fine. However, trying to rename either macro or type will fail.

image

Expected behavior

Macro definitions in hrl or erl files can also be renamed. erlang_ls can rename Function / Variable / MacroName / TypeName correctly.

Actual behavior

A clear and concise description of what happens instead.

Context

  • ELP Version (output of elp version): 1.1.0+build-2024-12-09
  • Editor used: Emacs
  • melpa package: lsp-mode: 20250106.2151

JimMoen avatar Jan 09 '25 14:01 JimMoen