fix(config): skip deprecation warning when integrations key is present
Problem: `migrate_integrations` warned about old top-level keys even when the user had already adopted `integrations`, which would be noisy for configs that happen to have both. Solution: only emit `vim.deprecate` and migrate values when `opts.integrations` was not explicitly provided. When it is, old top-level keys are silently stripped.
This commit is contained in:
parent
1b4d933148
commit
244cae33bd
1 changed files with 8 additions and 7 deletions
|
|
@ -604,16 +604,17 @@ end
|
||||||
local integration_keys = { 'fugitive', 'neogit', 'gitsigns', 'committia', 'telescope' }
|
local integration_keys = { 'fugitive', 'neogit', 'gitsigns', 'committia', 'telescope' }
|
||||||
|
|
||||||
local function migrate_integrations(opts)
|
local function migrate_integrations(opts)
|
||||||
|
local has_new = opts.integrations ~= nil
|
||||||
opts.integrations = opts.integrations or {}
|
opts.integrations = opts.integrations or {}
|
||||||
for _, key in ipairs(integration_keys) do
|
for _, key in ipairs(integration_keys) do
|
||||||
if opts[key] ~= nil then
|
if opts[key] ~= nil then
|
||||||
vim.deprecate(
|
if not has_new then
|
||||||
'vim.g.diffs.' .. key,
|
vim.deprecate(
|
||||||
'vim.g.diffs.integrations.' .. key,
|
'vim.g.diffs.' .. key,
|
||||||
'0.3.2',
|
'vim.g.diffs.integrations.' .. key,
|
||||||
'diffs.nvim'
|
'0.3.2',
|
||||||
)
|
'diffs.nvim'
|
||||||
if opts.integrations[key] == nil then
|
)
|
||||||
opts.integrations[key] = opts[key]
|
opts.integrations[key] = opts[key]
|
||||||
end
|
end
|
||||||
opts[key] = nil
|
opts[key] = nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue