mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(blink): correct properties for config validation
`blink.cmp` had an [update](834163eebd)
that forces strict config validation. This PR adapts to these changes.
Closes #5016.
This commit is contained in:
parent
aad0edbf74
commit
ce556fb8d1
6 changed files with 37 additions and 23 deletions
|
|
@ -61,8 +61,14 @@ return {
|
||||||
dependencies = { "codeium.nvim", "saghen/blink.compat" },
|
dependencies = { "codeium.nvim", "saghen/blink.compat" },
|
||||||
opts = {
|
opts = {
|
||||||
sources = {
|
sources = {
|
||||||
compat = { "codeium" },
|
default = { "codeium" },
|
||||||
providers = { codeium = { kind = "Codeium" } },
|
providers = {
|
||||||
|
codeium = {
|
||||||
|
name = "codeium",
|
||||||
|
module = "blink.compat.source",
|
||||||
|
kind = "Codeium",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} or nil,
|
} or nil,
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,14 @@ return {
|
||||||
dependencies = { "supermaven-nvim", "saghen/blink.compat" },
|
dependencies = { "supermaven-nvim", "saghen/blink.compat" },
|
||||||
opts = {
|
opts = {
|
||||||
sources = {
|
sources = {
|
||||||
compat = { "supermaven" },
|
default = { "supermaven" },
|
||||||
providers = { supermaven = { kind = "Supermaven" } },
|
providers = {
|
||||||
|
supermaven = {
|
||||||
|
name = "supermaven",
|
||||||
|
module = "blink.compat.source",
|
||||||
|
kind = "Supermaven",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} or nil,
|
} or nil,
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,14 @@ return {
|
||||||
dependencies = { "tzachar/cmp-tabnine", "saghen/blink.compat" },
|
dependencies = { "tzachar/cmp-tabnine", "saghen/blink.compat" },
|
||||||
opts = {
|
opts = {
|
||||||
sources = {
|
sources = {
|
||||||
compat = { "cmp_tabnine" },
|
default = { "cmp_tabnine" },
|
||||||
providers = { cmp_tabnine = { kind = "TabNine" } },
|
providers = {
|
||||||
|
cmp_tabnine = {
|
||||||
|
name = "cmp_tabnine",
|
||||||
|
module = "blink.compat.source",
|
||||||
|
kind = "TabNine",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ return {
|
||||||
build = vim.g.lazyvim_blink_main and "cargo build --release",
|
build = vim.g.lazyvim_blink_main and "cargo build --release",
|
||||||
opts_extend = {
|
opts_extend = {
|
||||||
"sources.completion.enabled_providers",
|
"sources.completion.enabled_providers",
|
||||||
"sources.compat",
|
|
||||||
"sources.default",
|
"sources.default",
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
@ -64,9 +63,6 @@ return {
|
||||||
-- signature = { enabled = true },
|
-- signature = { enabled = true },
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
-- adding any nvim-cmp sources here will enable them
|
|
||||||
-- with blink.compat
|
|
||||||
compat = {},
|
|
||||||
default = { "lsp", "path", "snippets", "buffer" },
|
default = { "lsp", "path", "snippets", "buffer" },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -80,18 +76,7 @@ return {
|
||||||
},
|
},
|
||||||
---@param opts blink.cmp.Config | { sources: { compat: string[] } }
|
---@param opts blink.cmp.Config | { sources: { compat: string[] } }
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- setup compat sources
|
|
||||||
local enabled = opts.sources.default
|
local enabled = opts.sources.default
|
||||||
for _, source in ipairs(opts.sources.compat or {}) do
|
|
||||||
opts.sources.providers[source] = vim.tbl_deep_extend(
|
|
||||||
"force",
|
|
||||||
{ name = source, module = "blink.compat.source" },
|
|
||||||
opts.sources.providers[source] or {}
|
|
||||||
)
|
|
||||||
if type(enabled) == "table" and not vim.tbl_contains(enabled, source) then
|
|
||||||
table.insert(enabled, source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TODO: remove when blink made a new release > 0.7.6
|
-- TODO: remove when blink made a new release > 0.7.6
|
||||||
if not vim.g.lazyvim_blink_main then
|
if not vim.g.lazyvim_blink_main then
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,15 @@ return {
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
{ "saadparwaiz1/cmp_luasnip" },
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
sources = { compat = { "luasnip" } },
|
sources = {
|
||||||
|
default = { "luasnip" },
|
||||||
|
providers = {
|
||||||
|
luasnip = {
|
||||||
|
name = "luasnip",
|
||||||
|
module = "blink.compat.source",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
snippets = {
|
snippets = {
|
||||||
expand = function(snippet)
|
expand = function(snippet)
|
||||||
require("luasnip").lsp_expand(snippet)
|
require("luasnip").lsp_expand(snippet)
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,10 @@ return {
|
||||||
sources = {
|
sources = {
|
||||||
default = { "dadbod" },
|
default = { "dadbod" },
|
||||||
providers = {
|
providers = {
|
||||||
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
dadbod = {
|
||||||
|
name = "Dadbod",
|
||||||
|
module = "vim_dadbod_completion.blink",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue