Closed OleStrohm closed 2 years ago
There is something amiss with :Telescope lsp_range_code_actions
, it produces none of the selection specific actions for me.
Here a comparison of the results for built in lsp range code action and telescope range code action commands for the jdtls ls:
Result of :'<,'>lua vim.lsp.buf.range_code_action()
(yields 8 actions):
Result of :'<,'>Telescope lsp_range_code_actions
(yields only 3 actions):
code_actions where removed from telescope in https://github.com/nvim-telescope/telescope.nvim/pull/1866
See :help telescope.changelog-1866
for more information
Description
I tried to get
:Telescope lsp_range_code_actions
to list all the code actions for a visual range, but it turns out this is quite buggy. This only cares about the start and end lines of the selection, which means it acts as though the selection is always a visual line selection. However since it always sets the start/end column to 0 it actually cuts off the last line when doing a visual line selection. As is apparent from the current implementation:I implemented my own function around lsp_code_actions:
And this simply gets the actual limits of the visual range, both the lines and the columns. However when I have a keymap to just call TSRCA (using 0.7 nightly
vim.keymap.set
) or like:lua TSRCA()<cr>
(So it adds'<,'>
before lua) I get placed ininsert (VISUAL LINE)
, but calling it like:<c-u>lua TSRCA()<cr>
it works correctly.Neovim version
Operating system and version
Arch linux 5.16.10-arch1-1
checkhealth telescope
Steps to reproduce
--
Expected behavior
I would expect
:Telescope lsp_range_code_actions
to ask the LSP for code actions that relate to the visual selection I've made.Actual behavior
It cuts off the last line in the selection (for example when using
extract to function
it extracts all but the last line of the selection, and selecting one line too much gives the expected behaviour). It doesn't work at all for normal visual range (for example when extracting an expression to a variable)Minimal config