pylsp-rope
pylsp-rope copied to clipboard
Neovim native LSP - first code action always fail
- pylsp-rope version: 0.1.2
- Text editor/IDE/LSP Client: Neovim - Native LSP
- Python version: Python 3.9.5
- Operating System:
Description
Adding details from this discussion thread.
Neovim native client worked, kinda. It does require two bits of special configuration to make range selection work in visual selection mode:
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('v', '<space>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR>', opts)
although the codeAction behavior in Neovim native LSP seems kinda buggy.
The first time you trigger a codeAction, it didn't pass the correct line number/character (it passes -1 or some such) instead of the selected range, but afterwards it worked fine, though its visual selection behavior seems kinda wonky (though to give it credit, it's the only LSP client that actually tried to preserve visual selection at all).
I suspect that this might be either a bug in neovim LSP client or maybe vim-lsp/ALE is just a bit more tolerant of incomplete initialization that python-lsp-server/pylsp-rope currently isn't doing.