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

LSP snippet: end_row out of bounds #20

Closed
f3fora opened this issue May 16, 2021 · 8 comments
Closed

LSP snippet: end_row out of bounds #20

f3fora opened this issue May 16, 2021 · 8 comments

Comments

@f3fora
Copy link

f3fora commented May 16, 2021

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

@L3MON4D3
Copy link
Owner

L3MON4D3 commented May 16, 2021

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?

@f3fora
Copy link
Author

f3fora commented May 16, 2021

nvim-compe master
I know it happens with texlab. I don't use other lsp so often in this period.

@L3MON4D3
Copy link
Owner

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.

@f3fora
Copy link
Author

f3fora commented May 17, 2021

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.

@L3MON4D3
Copy link
Owner

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?

@f3fora
Copy link
Author

f3fora commented May 18, 2021

Different version of nvim NVIM v0.5.0-dev+1231-g48e805728. But with only compe, luasnip and lspconfig, texlab snippets work correctly.

@L3MON4D3
Copy link
Owner

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

@f3fora
Copy link
Author

f3fora commented May 18, 2021

Thanks! If I find a way to reproduce it I will continue this issue!
Great plugin however

@L3MON4D3 L3MON4D3 closed this as completed Mar 8, 2023
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

2 participants