Closed wuilliam321 closed 2 years ago
Mhm, that's a fix for the errors, but I'm not sure if failing silently if we don't even know where the error originates is the best idea.
There could be more problems if snip is nil
, it cannot be expanded for example.
I found another way to make it work, but, i'll leave here the way I reproduce the error;
local ls = require'luasnip'
ls.snippets = {
all = {ls.parser.parse_snippet('expand', '-- this is an expanded snippet')},
}
then when you write expand
and choose the snippet from cmp
dropdown, the error happens
But,
this way works great:
local ls = require'luasnip'
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
ls.add_snippets('all', {
s('ternary', {
i(1, 'cond'),
t(' ? '),
i(2, 'then'),
t(' : '),
i(3, 'else'),
}),
})
Maybe there is another reason why
snip
is nil, but it fails when trying to navigatecmp
dropdown.