zed
zed copied to clipboard
'Rename Symbol" command doesn't rename all the occurrences
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Renaming a symbol local to a function doesn't rename all the occurrences.
Video:
https://github.com/zed-industries/zed/assets/145113/23f599ef-c4d4-4f33-bd58-20bec295fcb5
Notice how some of the occurrences are not renamed.
Environment
Zed: v0.120.5 (Zed) OS: macOS 14.2.0 Memory: 32 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.
No response
I believe this affects more than just C and C++. Here I've recorded a video of a similar thing happening in Ruby:
https://github.com/zed-industries/zed/assets/77887/7719a29b-c747-4469-867f-548d9ad2c4e4
You can see in my example, in addition to missing one of the occurrences, it also "doubles" the change on the first instance (I tried initiating a rename on the last instance, and it still doubles the first one, not the one I initiated from).
Renaming is not working at all with me for some previous versions, after changing pressing Enter or CMD + Enter makes nothing.
Renaming is not working at all with me for some previous versions, after changing pressing Enter or CMD + Enter makes nothing.
Same here
Renaming is not working at all with me for some previous versions, after changing pressing Enter or CMD + Enter makes nothing.
Same here
Hi @Jeordanis,
I've noticed that in your video there are a bunch of squiggles (I assume clangd: use of undeclared identifier). In attempting to reproduce this issue I observed the clangd language server rename functionality does not function properly when it has a bunch of unindentified symbols.
On the other hand, when those stubbed it behaves as expected:
https://github.com/zed-industries/zed/assets/145113/3856f8ba-5538-4d11-80b3-323a85cd7bde
Renaming is not working at all with me for some previous versions, after changing pressing Enter or CMD + Enter makes nothing.
Also not working for me. Rename symbol (both in vim and standard mode) does nothing.
Edit: just tested, it works in Python, but not in Elixir, so the problem is elixir (maybe even elixir-ls) specific.
Zed 0.143.6 Linux
Zed 0.163.2 I confirm Rename symbol does not work (Rust)
This was such a big feature it would be very important if they could check and prioritise this.
Can anyone create a minimal repo which can reproduce this issue? The core of rename functionality is handled by the language server (which works for me in Rust with rust-analyzer) but there's obviously Zed code involved in resolving the edits which could be failing with some projects/environments. My previous comment demonstrates one such case (clangd doesn't handle renames properly when there missing/unresolved symbols involved) but I wonder if there are others.
Since there are multiple people reporting issues in multiple languages I'd love to see if we can get to the bottom of this.
Well mine it's with PHP, i remembering working in the initial versions but since months ago it stopped working and never returned. I've just tried again with the same issue, with me it does not replace nothing, not even the selected symbol itself. I bet if you create a php file with a function the results should be the same.
Same issue for PHP. It doesn't replace anything
We're unable to reproduce this internally (with Rust/Go/Typescript/Python).
Rename is provided by the LSP, so it does seem plausible that there are cases where it's not working; but to make more progress we'll need a repo/file that reproduces the problem.
Does anyone have something they could share?
It still has bugs in PHP.
If I'm using intelephense I get this:
I'm using the pro version and it does support renaming symbols.
Even disabling and using the default phpactor it's strange, renaming works inside classes but does not work with single functions for example.
PS: Just to keep in mind renaming worked perfectly in all scenarios (I think it used intelephense back then) before Zed moved PHP into an extension. In VScode it's working normally with intelephense in all scenarios.
See the same issue with Ruby + ruby-lsp. I can select the word, see LSP highlight the other matching words, enter renamed value, try to confirm it via selecting "Editor: confirm rename" or pressing "Enter". In either case, the "rename" line goes away, and all words (including the word I selected for rename) stay unchanged.
See the same issue with Ruby + ruby-lsp. I can select the word, see LSP highlight the other matching words, enter renamed value, try to confirm it via selecting "Editor: confirm rename" or pressing "Enter". In either case, the "rename" line goes away, and all words (including the word I selected for rename) stay unchanged.
This is what I see when renaming in Scala too -- I enter the new name, press enter and everything is as it was before
Rename is implemented in the language server. Zed sends textDocument/rename and then the LSP replies with a list of documentChanges (and potentially file renames or other changes), which Zed then applies to the buffer and sends textDocument/didChange back to the LSP when the edits have been applied.
Can you take a look at debug: language server logs, choose your LSP and open RPC messages to see more. Is there anything in your Zed.log when this happens?
Can anyone provide a trivial repo + steps which reproduces this behavior?
Can anyone provide a trivial repo + steps which reproduces this behavior?
I'm using Mill + Metals (https://scalameta.org/metals/docs/build-tools/mill/). To try to get you a reproducible case, I just removed my .bsp and .metals directories and re-opened the project. And now renaming works. That's probably frustrating for you, but I'm happy! Hopefully this helps someone else
I'm going to go ahead and close this as unactionable. Individual language servers have varying levels of support for this and some are not able to find all references to filenames consistently.
If anyone can come up with reproducible steps from an empty folder in a repo for a particular LSP please open a clean issue and I'd love to dive in.
Thanks all!