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

lsp-rename behaves weird

Open Hespian opened this issue 5 years ago • 2 comments

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

Hespian avatar Nov 19 '19 15:11 Hespian

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.

Hespian avatar Nov 20 '19 10:11 Hespian

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?

youben11 avatar Nov 24 '19 10:11 youben11