LuaSnip
LuaSnip copied to clipboard
LSP snippet: end_row out of bounds
<Plug>luasnip-expand-or-jump
raises sometimes an error after an expansion of a LSP snippet . It happens "randomly", because actually I haven't found yet a way to reproduce it.
The error:
LuaSnip/lua/luasnip/nodes/snippet.lua:318: end_row out of bounds
I know that require('luasnip').expand_or_jumpable()
returns true.
Sounds like something is messing with extmarks and moving them beyond the end of the line (hence 'end_row out of bounds'). I think that can happen if the line is changed with nvim_set_text(), my best guess would be that something (lsp? compe?) is setting the text in the line at some point, which would explain the random nature of the issue. Does this happen on all LSPs? Which version of compe are you on?
nvim-compe
master
I know it happens with texlab. I don't use other lsp so often in this period.
Okay, I didn't experience your error with texlab (so far), but I did notice that, after updating compe (which
I didn't do for some time), ccls
-Snippet's extmarks get moved around after expansion, while Snippets from other LSPs (rust-analyzer
) still work fine.
Could you check if you have the same issue with compe@4b3ade1
, which is the last version I used.
On a side note, does the \begin
-Snippet work for you? I just tried it and when entering text into $1 and leaving it, it completely removes the\end
-part.
Could you check if you have the same issue with compe@
4b3ade1
, which is the last version I used.
I tested using master and this commit. I got the same results.
ccls
-Snippet's extmarks get moved around after expansion, while Snippets from other LSPs (rust-analyzer
) still work fine.
For me they work fine. Actually I used ccls
for a few tests, I personally use clangd
.
On a side note, does the
\begin
-Snippet work for you? I just tried it and when entering text into $1 and leaving it, it completely removes the\end
-part.
Yes, it works. Actually I discover the issue #20 using this Snippet.
Wow, weird... different nvim maybe? I'm on NVIM v0.5.0-dev+1323-gd67dcaba0
.
Apart from that, have you tried disabling all plugins except compe and luasnip?
Different version of nvim NVIM v0.5.0-dev+1231-g48e805728
. But with only compe, luasnip and lspconfig, texlab snippets work correctly.
Okay, that's good to know. Do you have any linters or similar tools installed that could set text for the entire buffer?
To further debug, you could :lua Luasnip_current_nodes[vim.api.nvim_get_current_buf()].parent:dump()
after the misbehaviour to see node boundaries (eg. where extmarks get moved to).
Thanks! If I find a way to reproduce it I will continue this issue! Great plugin however