mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat: an extra for mini.snippets. Review dpetka: use table.insert for opts.sources.default
This commit is contained in:
parent
852beed925
commit
650ce200f1
1 changed files with 9 additions and 10 deletions
|
|
@ -120,8 +120,9 @@ return {
|
|||
-- stylua: ignore
|
||||
-- Use mini.snippets to expand snippets from lsp:
|
||||
opts.snippet = { expand = function(args) expand(args) end }
|
||||
|
||||
-- Show the snippets provided by mini.snippets in the completion popup:
|
||||
if snippets_in_cmp then
|
||||
-- show the snippets provided by mini.snippets in the completion popup:
|
||||
table.insert(opts.sources, { name = "mini_snippets" })
|
||||
end
|
||||
end,
|
||||
|
|
@ -138,16 +139,14 @@ return {
|
|||
snippets_in_cmp = false
|
||||
snippet_select = snippet_select_for_blink
|
||||
|
||||
-- Remove builtin snippets source
|
||||
opts.sources.default = vim.tbl_filter(function(source)
|
||||
return source ~= "snippets"
|
||||
end, opts.sources.default)
|
||||
|
||||
-- Show the snippets provided by mini.snippets in the completion popup:
|
||||
if snippets_in_cmp then
|
||||
opts.sources.default = { "mini_snippets" }
|
||||
else
|
||||
-- No snippets in completion, remove blink's builtin snippets
|
||||
opts.sources.default = vim.tbl_filter(function(source)
|
||||
if source == "snippets" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end, opts.sources.default)
|
||||
table.insert(opts.sources.default, "mini_snippets")
|
||||
end
|
||||
|
||||
-- Blink defines the <s-tab> key.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue