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

code_action makes unexpected ranges when it called form linewise-visual mode #22629

Closed
kyoh86 opened this issue Mar 11, 2023 · 2 comments · Fixed by #22632
Closed

code_action makes unexpected ranges when it called form linewise-visual mode #22629

kyoh86 opened this issue Mar 11, 2023 · 2 comments · Fixed by #22632
Labels
bug issues reporting wrong behavior lsp

Comments

@kyoh86
Copy link

kyoh86 commented Mar 11, 2023

Problem

If I call vim.lsp.buf.code_action() from linewise-visual mode (V) without explicit range, it makes a range by range_from_selection().
But it gives not a line-wise range but a characters-wise.

It may makes a buggy behavior like #21326 .

Steps to reproduce using "nvim -u minimal_init.lua"

It requires a LSP supporting code_action with a range like gopls.
(I'm using gopls )
So I should prepare a dependencies with like Dockerfile to reproduce it.
I'll do it later.

note for me:

require("lspconfig").gopls.setup {}
vim.vim.lsp.set_log_level(vim.log.levels.TRACE)
vim.keymap.set("v", "<leader>lca", vim.lsp.buf.code_action)

Expected behavior

It makes line-wise range.

Neovim version (nvim -v)

v0.9.0-dev-286777c

Language server name/version

gopls v0.11.0

Operating system/version

Ubuntu 22

Log file

https://gist.github.com/kyoh86/3cbeb80ff07bfee93a84503aedb25e42

@kyoh86 kyoh86 added bug issues reporting wrong behavior lsp labels Mar 11, 2023
mfussenegger added a commit to mfussenegger/neovim that referenced this issue Mar 11, 2023
@mfussenegger
Copy link
Member

Could you try with #22632 ?

@kyoh86
Copy link
Author

kyoh86 commented Mar 11, 2023

@mfussenegger Thanks for the super fast fix, seriously. It's perfect!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior lsp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants