Open balazser opened 1 year ago
Hi @balazser, thanks for writing this issue.
A few questions, what lsp client are you using? Are you using the native Neovim lsp, CoC, vim-lsp, or something else?
Hi @lieryan,
I'm using native nvim lsp with neovim/nvim-lspconfig
. Is there anything else I can do to help you with debugging?
Hi @balazser, thanks for clarifying that you're using Neovim's native LSP client.
The codeaction support in Neovim's native LSP is very, very buggy. I had already documented some of the issues of neovim native client here, but one of the most visible and annoying bug is that neovim sends garbage line/col numbers to the LSP server on the first code action triggered in a file in an editing session. I had just retested this again just now on NVIM v0.7.2 (the latest Neovim version available on Ubuntu), and the bug is still there; I'm surprised Neovim hadn't fixed this glaring bug for so long.
There's not much we can really do to workaround this bug from within pylsp-rope, we could have caught the garbage value to prevent the pylsp-rope from returning a traceback, but that's really only hiding a broken client behavior. None of the other LSP clients in Vim that I tested on (vim-lsp, ALE, and Coc) exhibits this behavior.
To workaround this bug, you need to select a text, trigger a code action, unselect the text, re-select again, and then re-trigger the code action. Obviously, that is an unusably bad user experience, which is why our docs recommends against using the Neovim native LSP. Any of the other LSP plugins works well in Neovim. Click here for a video demonstrating the issue and the workaround.
If you want to help with this issue, you can try reporting the bug in Neovim's bug tracker.
Description
I have installed pylsp-rope and experiencing issues with the extract (global as well) method functionality.
Describe what you were trying to get done.
The examples from https://github.com/python-rope/rope/blob/master/docs/overview.rst#extract-method end up with the errors in the following section.
Tell us what happened, what went wrong, and what you expected to happen.
Without nvim region/visual-mode:
With nvim region/visual-mode:
Details
Better exception: