python-language-server
python-language-server copied to clipboard
lsp-rename behaves weird
When I try to rename a variable in emacs, say "foo" to "foo2", and then try to rename it back to "foo", nothing happens. If I then rename a different variable, say "bar" to "bar2", then "foo" gets changed back to "foo". If I then rename "foo" to "foo2" again, "bar2" gets renamed to "bar".
Here are the contents of the *lsp-log: pyls buffer: https://pastebin.com/qFAr8Ajx (The first rename call with response null was just because I didn't save the file before calling lsp-rename)
I use a freshly installed version of pyls via pip3
Ok, I just found out that this doesn't happen if I save the file in between renames. Is that intended behaviour? It seems rather unintuitive and is not consistent with what clangd as C++ lsp server does.
I noticed that rope_rename isn't saving changes, I don't know if the client should be the one who make the save here or that pyls should be doing this through workspace.apply_edit.
I also tried it with vscode and changes aren't saved and trying to rename two symbols without saving the doc in between doesn't make the call to rope_rename at all.
@gatesn any thoughts about this?