Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim native LSP - first code action always fail #5

Open
lieryan opened this issue Oct 4, 2021 · 0 comments
Open

Neovim native LSP - first code action always fail #5

lieryan opened this issue Oct 4, 2021 · 0 comments

Comments

@lieryan
Copy link
Member

lieryan commented Oct 4, 2021

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant