Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/ruby_lsp/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,12 @@ def create_discover_tests_listener(response_builder, dispatcher, uri); end
def resolve_test_commands(items)
[]
end

# Allows add-ons to add additional file rename operations during a rename request. This is invoked after the
# standard file rename logic and allows add-ons to handle cases where file naming conventions differ from the
# default (e.g., Rails migration files with timestamp prefixes)
# @overridable
#: (String fully_qualified_name, String new_name, Array[(Interface::RenameFile | Interface::TextDocumentEdit)] document_changes) -> void
def collect_file_renames(fully_qualified_name, new_name, document_changes); end
end
end
5 changes: 5 additions & 0 deletions lib/ruby_lsp/requests/rename.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def perform
end

collect_file_renames(fully_qualified_name, document_changes)

Addon.addons.each do |addon|
addon.collect_file_renames(fully_qualified_name, @new_name, document_changes)
end

Interface::WorkspaceEdit.new(document_changes: document_changes)
end

Expand Down