Skip to content

Add collect_file_renames addon hook for rename requests#3958

Open
sucicfilip wants to merge 1 commit intoShopify:mainfrom
sucicfilip:feature/rename-addon-hook
Open

Add collect_file_renames addon hook for rename requests#3958
sucicfilip wants to merge 1 commit intoShopify:mainfrom
sucicfilip:feature/rename-addon-hook

Conversation

@sucicfilip
Copy link
Contributor

Motivation

This adds an addon hook so that add-ons can participate in file renames during textDocument/rename.

Right now, collect_file_renames only renames files that exactly match the constant's snake_case name (e.g. Foo → foo.rb). This doesn't cover cases where file naming conventions include prefixes or other patterns. For example, Rails migration files like 20241030120000_create_users.rb.

Closes Shopify/ruby-lsp-rails#497 (the ruby-lsp-rails side will follow in a separate PR)

Implementation

  • Added collect_file_renames(fully_qualified_name, new_name, document_changes) to the Addon class
  • Add-ons can push Interface::RenameFile entries into document_changes

Automated Tests

No tests added here since the hook is a no-op by default. The ruby-lsp-rails PR will have tests covering the actual behavior.

Manual Tests

-

@sucicfilip sucicfilip force-pushed the feature/rename-addon-hook branch from 0494d3a to deae3bc Compare February 15, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Automatically rename migration file to follow class name

1 participant