Skip to content

Add Prepare Rename Request#2894

Merged
vinistock merged 2 commits into
Shopify:mainfrom
ro-gun:feat/prepare_rename_request
Nov 27, 2024
Merged

Add Prepare Rename Request#2894
vinistock merged 2 commits into
Shopify:mainfrom
ro-gun:feat/prepare_rename_request

Conversation

@ro-gun
Copy link
Copy Markdown
Contributor

@ro-gun ro-gun commented Nov 21, 2024

Motivation

Closes #2854

Implementation

If the position of the prepareRename request corresponds to a node of type Prism::ConstantReadNode, Prism::ConstantPathNode, or Prism::ConstantPathTargetNode, the range of the node will be returned; otherwise, it will return nil.

Automated Tests

Added new tests

Manual Tests

Screencast.from.21-11-24.10.34.25.PM.IST.webm

@ro-gun ro-gun requested a review from a team as a code owner November 21, 2024 17:11
@andyw8
Copy link
Copy Markdown
Contributor

andyw8 commented Nov 21, 2024

Nice! Do you know if the "The element can't be renamed" message can be customized?

@ro-gun
Copy link
Copy Markdown
Contributor Author

ro-gun commented Nov 22, 2024

To set a customized message, the error code and message need to be included in the response.

@vinistock vinistock added server This pull request should be included in the server gem's release notes enhancement New feature or request labels Nov 27, 2024 — with Graphite App
Copy link
Copy Markdown
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This is essentially ready to ship, I just left a few minor comments to adjust.

Comment thread lib/ruby_lsp/requests/prepare_rename.rb Outdated
Comment thread lib/ruby_lsp/requests/prepare_rename.rb Outdated
Comment thread lib/ruby_lsp/requests/prepare_rename.rb Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide 'Rename Symbol' when not available

3 participants