impl Rename Refactors #2207 - #2661
asukaminato0721 wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds rename refactoring options (rename in comments/strings and in non-Python text files) and introduces LSP linkedEditingRange support for inline rename ranges, wiring both through workspace configuration and adding interaction tests/fixtures.
Changes:
- Add
pyrefly.renameworkspace config (commentsAndStrings,textOccurrences) and propagate into LSP server behavior. - Implement comment/string scanning + workspace-wide non-Python text scanning to produce additional rename edits.
- Add
linkedEditingRangecapability/handler and LSP interaction tests + fixtures.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pyrefly/lib/lsp/non_wasm/server.rs |
Implements rename options, workspace text scanning, and linkedEditingRange request handling/capability. |
pyrefly/lib/lsp/non_wasm/workspace.rs |
Adds RenameConfig to workspace settings and configuration application/getter. |
pyrefly/lib/state/lsp.rs |
Adds helpers to find identifier occurrences in comment/string content ranges. |
pyrefly/lib/test/lsp/lsp_interaction/rename.rs |
Adds LSP interaction tests for rename options + linked editing ranges. |
pyrefly/lib/test/lsp/lsp_interaction/test_files/rename_inline_options/main.py |
New fixture covering code, comment, and string occurrences. |
pyrefly/lib/test/lsp/lsp_interaction/test_files/rename_inline_options/notes.txt |
New fixture for text occurrence renames in non-Python files. |
lsp/package.json |
Exposes python.pyrefly.rename settings in the extension schema. |
pyrefly/Cargo.toml / Cargo.lock |
Adds the ignore crate dependency used for workspace walking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This comment has been minimized.
This comment has been minimized.
8f9890d to
eb13a90
Compare
This comment has been minimized.
This comment has been minimized.
kinto0
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This comment has been minimized.
This comment has been minimized.
eb13a90 to
35325fa
Compare
This comment has been minimized.
This comment has been minimized.
35325fa to
cf33221
Compare
This comment has been minimized.
This comment has been minimized.
cf33221 to
35b66c3
Compare
This comment has been minimized.
This comment has been minimized.
35b66c3 to
b683000
Compare
This comment has been minimized.
This comment has been minimized.
82d5408 to
52321e0
Compare
This comment has been minimized.
This comment has been minimized.
Merging this PR will not alter performance
Comparing Footnotes
|
This comment has been minimized.
This comment has been minimized.
kinto0
left a comment
There was a problem hiding this comment.
AI comments:
- Was scoping considered for commentsAndStrings? PyCharm restricts comment/string search to the usage search scope; here any comment in any loaded module containing the bare word gets rewritten, including
modules with their own unrelated foo. That's a lot of unexpected edits behind a single boolean. - linkedEditingRange is now advertised whenever indexing_mode != None, which changes behavior for all users who have editor.linkedEditing on — independent of the two new settings. Intentional?
fc3947c to
0e0b33d
Compare
This comment has been minimized.
This comment has been minimized.
0e0b33d to
4ec8c2d
Compare
This comment has been minimized.
This comment has been minimized.
5 similar comments
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Summary
Fixes part of #2207
Implemented rename refactoring options for comments/strings and text occurrences, aligned with PyCharm’s inline rename behavior and availability cues.
Added LSP linkedEditingRange support for inline rename ranges in-file, and wired the new rename options through workspace config.
Test Plan
Added LSP interaction tests and fixtures covering comment/string and text-file occurrences, plus linked editing ranges.