You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
localcmp=require'cmp'localluasnip=require'luasnip'localhas_words_before=function()
unpack=unpackortable.unpacklocalline, col=unpack(vim.api.nvim_win_get_cursor(0))
returncol~=0andvim.api.nvim_buf_get_lines(0, line-1, line, true)[1]:sub(col, col):match("%s") ==nilendlocalcmp_kinds= {
Text=' ',
Method=' ',
Function=' ',
Constructor=' ',
Field=' ',
Variable=' ',
Class=' ',
Interface=' ',
Module=' ',
Property=' ',
Unit=' ',
Value=' ',
Enum=' ',
Keyword=' ',
Snippet=' ',
Color=' ',
File=' ',
Reference=' ',
Folder=' ',
EnumMember=' ',
Constant=' ',
Struct=' ',
Event=' ',
Operator=' ',
TypeParameter=' ',
}
cmp.setup({
snippet= {
-- REQUIRED - you must specify a snippet engineexpand=function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.luasnip.lsp_expand(args.body) -- For `luasnip` users.-- require('snippy').expand_snippet(args.body) -- For `snippy` users.-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.end
},
formatting= {
format=function(_, vim_item)
vim_item.kind= (cmp_kinds[vim_item.kind] or'') ..vim_item.kindreturnvim_itemend,
},
window= {
completion=cmp.config.window.bordered(),
documentation=cmp.config.window.bordered()
},
mapping= {
["<Tab>"] =cmp.mapping(function(fallback)
ifcmp.visible() thencmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()-- that way you will only jump inside the snippet regionelseifluasnip.expand_or_jumpable() thenluasnip.expand_or_jump()
elseifhas_words_before() thencmp.complete()
elsefallback()
endend, { "i", "s" }),
["<S-Tab>"] =cmp.mapping(function(fallback)
ifcmp.visible() thencmp.select_prev_item()
elseifluasnip.jumpable(-1) thenluasnip.jump(-1)
elsefallback()
endend, { "i", "s" }),
},
sources= {
{ name='nvim_lsp' },
{ name='luasnip ', option= { use_show_condition=false, show_autosnippets=true } },
{ name='buffer' },
{ name='nvim_lsp_signature_help' }
}
-- sources = cmp.config.sources({-- { name = 'luasnip' },-- {name = 'nvim_lsp'}, {name = 'vsnip'} -- For vsnip users.-- }, {{name = 'buffer'}, {name = 'nvim_lsp_signature_help'}})
})
-- Set configuration for specific filetype.cmp.setup.filetype('gitcommit', {
sources=cmp.config.sources({
{name='cmp_git'} -- You can specify the `cmp_git` source if you were installed it.
}, {{name='buffer'}})
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).cmp.setup.cmdline({'/', '?'}, {
mapping=cmp.mapping.preset.cmdline(),
sources= {{name='buffer'}}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).cmp.setup.cmdline(':', {
mapping=cmp.mapping.preset.cmdline(),
sources=cmp.config.sources({{name='path'}}, {{name='cmdline'}})
})
-- Set up lspconfig.localcapabilities=require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['tsserver'].setup {capabilities=capabilities}
Description
Hello! I apologize in advance for my English.
I've installed the Luasnip plugin, write my own snippets for python. Then, I started work in neovim, try to use my snippets, but while I navigating through menu for select snippet neovim crash with that error:
I've try to find solution, but is none. This is my snippet:
After debugging nvim-cmp plugin I found that description from my plugin in lua code not string as expected. Its a table (array) with one element - string with description.
Steps to reproduce
Add luasnip plugin
In cmp config select snippet section with luasnip.lsp_expand
FAQ
Announcement
Minimal reproducible full config
Description
Hello! I apologize in advance for my English.
I've installed the Luasnip plugin, write my own snippets for python. Then, I started work in neovim, try to use my snippets, but while I navigating through menu for select snippet neovim crash with that error:
I've try to find solution, but is none. This is my snippet:
After debugging nvim-cmp plugin I found that description from my plugin in lua code not string as expected. Its a table (array) with one element - string with description.
Steps to reproduce
luasnip.lsp_expand
require('luasnip.loaders.from_vscode').load({paths = "~/path/to/snippets"})
:LuaSnipListAvailable
)Expected behavior
Description as string. In JSON its string
Actual behavior
Description - table (array) with one element - string
Additional context
I fixed that in my local machine. Next step after that Issue I create PR with fix
The text was updated successfully, but these errors were encountered: