garymjr / garymjr/nvim-snippets
Can't expand some snippet
- Dominant language
- Lua
- Stars
- 259
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
It may be my fault, but when I use the "[if err != nil](https://github.com/rafamadriz/friendly-snippets/blob/00ebcaa159e817150bd83bfe2d51fa3b3377d5c4/snippets/go.json#L117)" snippet in golang files. When I use `nvim-cmp` to confirm the snippet, it will be expanded to an empty string.
Here is my config:
```lua
{
'garymjr/nvim-snippets',
dependencies = { 'rafamadriz/friendly-snippets' },
opts = {
create_cmp_source = true,
friendly_snippets = true,
},
keys = {
{
'',
function()
if vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
return
end
return ''
end,
expr = true,
silent = true,
mode = 'i',
},
{
'',
function()
vim.schedule(function()
vim.snippet.jump(1)
end)
end,
expr = true,
silent = true,
mode = 's',
},
{
'',
function()
if vim.snippet.active({ direction = -1 }) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
return
end
return ''
end,
expr = true,
silent = true,
mode = { 'i', 's' },
},
},
event = 'insertenter',
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with the friendly-snippets Go entry in snippets/go.json at line 117 and the provided nvim-snippets configuration. Trace the expansion from confirmation through the native Neovim snippet integration; done means the [if err != nil] snippet expands to its intended content instead of an empty string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, lua, neovim
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100