Skip to content

Commit

Permalink
Support renaming function when standing on spec (erlang-ls#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
plux committed Feb 4, 2022
1 parent 3e7ef67 commit 3e9902a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/els_lsp/src/els_rename_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ workspace_edits(_Uri, [], _NewName) ->
workspace_edits(Uri, [#{kind := function_clause} = POI| _], NewName) ->
#{id := {F, A, _}} = POI,
#{changes => changes(Uri, POI#{kind => function, id => {F, A}}, NewName)};
workspace_edits(Uri, [#{kind := spec} = POI| _], NewName) ->
#{changes => changes(Uri, POI#{kind => function}, NewName)};
workspace_edits(Uri, [#{kind := Kind} = POI| _], NewName)
when Kind =:= define;
Kind =:= record;
Expand Down
2 changes: 2 additions & 0 deletions apps/els_lsp/test/els_rename_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ rename_function(Config) ->
#{result := Result} = els_client:document_rename(Uri, 1, 9, NewName),
%% Import entry
#{result := Result} = els_client:document_rename(ImportUri, 2, 26, NewName),
%% Spec
#{result := Result} = els_client:document_rename(Uri, 3, 2, NewName),
Expected = #{changes =>
#{binary_to_atom(Uri, utf8) =>
[ change(NewName, {12, 23}, {12, 26})
Expand Down

0 comments on commit 3e9902a

Please sign in to comment.