Skip to content

Commit

Permalink
feat: default to vim.snippet for snippet expansion if available (#1820
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mehalter authored Mar 21, 2024
1 parent 763c720 commit 66f0a03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ lua <<EOF
-- require('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.
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
window = {
Expand Down
1 change: 1 addition & 0 deletions doc/cmp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ A recommended configuration can be found below.
-- require('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.
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
window = {
Expand Down
4 changes: 3 additions & 1 deletion lua/cmp/config/default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ return function()
mapping = {},

snippet = {
expand = function(_)
expand = vim.snippet and function(args)
vim.snippet.expand(args.body)
end or function(_)
error('snippet engine is not configured.')
end,
},
Expand Down

0 comments on commit 66f0a03

Please sign in to comment.