hrsh7th / vim-vsnip

Snippet plugin for vim/nvim that supports LSP/VSCode's snippet format.
MIT License
885 stars 36 forks source link

Undefined variable: prefix (?) #152

Closed coxackie closed 3 years ago

coxackie commented 3 years ago

First of all, many thanks for your work.

Completely noob question, trying to figure out what is going on. So, I have created a .vsnip/tex.json link to the latex.json file from the vscode extension Latex workshop. It is the one here, for ease of reference.

Have set up completion via completion-nvim, and using vsnip as snippet engine - also have installed the integration. Now, when I try to autocomplete (which works fine as long as there is no snippet file), I get:

Error executing vim.schedule lua callback: ...lugged/completion-nvim/lua/completion/source/snippet.lua:63: Vim(let):E121: Undefined variable: prefix

I am not sure what the issue is, and even whether I should raise it here or with completion-nvim (or whether I am doing something really stupid). Any advise would be greatly appreciated.

coxackie commented 3 years ago

ok, I found the culprit, one of the snippets there had no "prefix". But I am still not able to get snippets expand for tex files. I use the key mappings described in the readme. They work ok, for example, for an r file, using this. But, for tex files, I type the snippet name and then in insert mode and it just skips a line. :(

hrsh7th commented 3 years ago

I will improve it

coxackie commented 3 years ago

thanks - I appreciate that, but I am not sure what is the actual issue. It could be something wrong with the texlab client right now, because of this, which could potentially get fixed by this. However, I am noticing the issue also with the clangd server: does not make the snippet appear, it just changes line in insert mode. With R and Rust it works. I am using latest nightly.

hrsh7th commented 3 years ago

I've improved handling snippet as just ignore invalid snippet (e.g.: has no prefix, has no body etc...)

If you still encountered this problem, I think it is not vsnip side problem maybe.

coxackie commented 3 years ago

many thanks - you are awesome!