kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

refactor rename does not change references in other files

Open dewijones92 opened this issue 2 years ago • 2 comments

...it only only changes the references in the current buffer. btw.. thanks for an amazing repo

dewijones92 avatar May 27 '22 06:05 dewijones92

Seems like rename, like you said, only changes the references in the current buffer/file... Until I open the other affected files! Then they suddenly change... (verified this by opening them first in another editor to verify they hadn't change, and then Emacs). This seems to be an Emacs lsp-mode related issue though, as I do NOT experience this when trying this in VSCode. If I inspect the output of the textDocument/rename-operation, then I see all the files that should be edited. Unsure on which editor you are using, just guessed that you are using Emacs as well due to the use of the word "buffer" 🙂

Unsure on how to solve this atm 🙁 lsp-mode seems to rely on find-file-noselect, which should in theory open the files to my knowledge... (it might be affected by other mode-specific settings though). The problem is the same for rust-analyzer in Emacs as well, and most lsp-servers. I need to open the files for the rename to take place. Just thought the rename operations in the lsp servers I was using was buggy until I investigated today, as they have never worked for me 😛 Always did workarounds with multiple-cursors in multiple files for this... EDIT: Seems like the buffers are opened in the background, I just missed it (not showing up in Helm buffer list for some reason). Still have to save the edits manually... This was not very intuitive.

Another issue regarding this, that I experienced while working on #393, is that you can't do a rename at the declaration site (i.e, where your val/var statement is). This might be fixed by doing some of the same things as that PR.

themkat avatar Sep 24 '22 12:09 themkat

Another issue regarding this, that I experienced while working on #393, is that you can't do a rename at the declaration site (i.e, where your val/var statement is). This might be fixed by doing some of the same things as that PR.

That one is a known issue: see https://github.com/fwcd/kotlin-language-server/issues/320

daplf avatar Sep 25 '22 23:09 daplf