feat: default to vim.snippet for snippet expansion if available (#1820)
This commit is contained in:
@@ -68,6 +68,7 @@ lua <<EOF
|
|||||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ A recommended configuration can be found below.
|
|||||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
|
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ return function()
|
|||||||
mapping = {},
|
mapping = {},
|
||||||
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(_)
|
expand = vim.snippet and function(args)
|
||||||
|
vim.snippet.expand(args.body)
|
||||||
|
end or function(_)
|
||||||
error('snippet engine is not configured.')
|
error('snippet engine is not configured.')
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user