Closed glandir closed 6 months ago
It simply return firstline -1 for inner function, PR welcome.
I have a similar issue with pyright
, also done with a similar mini vimrc:
pressing vaf
here results in the following:
and vif
in this:
I'm not sure if it is related or not.
Same problem for coc-classobj-i and coc-classobj-a
@ferdinandyb Pyright has fixed this, https://github.com/microsoft/pylance-release/issues/1014
I'll check soonish, thanks for the heads-up!
@ferdinandyb the fixes has not been released yet.
For clangd issue, I think it's hard to solve in coc. coc just returns start.line - 1
for inner function, but if the code is not well formatted, coc doesn't know how to handle it.
void f() {
// body (1)
}
vif
on (1) on works as expected.
Result from CocInfo
Describe the bug
The text objects
coc-funcobj-a
andcoc-funcobj-i
give incorrect ranges for some language servers. I observed this withcoc-clangd
andcoc-rls
.For the
coc-funcobj-i
text object, this code just takes the range for the complete function and removes the first and last line, which doesn't work for function signatures spanning multiple lines: https://github.com/neoclide/coc.nvim/blob/d6dd56bba8992aae3ade4034f1bc8d1148c3780f/src/handler/index.ts#L817-L822 It's probably not possible to do this more accurately without LSP support, but some documentation about it would be helpful. I was initially unsure whether this was an issue with coc or with clangd.I have no idea why
coc-funcobj-a
doesn't work, though. Reading the code, it seems to just use the range reported by the server, but the end position is always one line too high.Reproduce the bug
Create file
mini.vim
with:Create file
main.cpp
with:Start (neo)vim with command:
nvim -u mini.vim main.cpp
With the cursor on
(1)
, hitvaf
. The selection spans from the beginning of the first line until the first slash; we would expect the selection to end one line later.With the cursor on
(1)
, hitvif
. The selection spans from the brace in the second line until the first slash on line 3.With the cursor on
(2)
, hitvif
. This time the selection includes the return type (-> void
) and the entire line before the closing brace.Screenshots (optional)