mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 12:31:07 +00:00
feat(extras): automatically update lazyvim.json for renamed or deprecated extras
This commit is contained in:
parent
d44f8bf317
commit
37ecd06fad
1 changed files with 20 additions and 3 deletions
|
|
@ -25,12 +25,29 @@ end
|
||||||
local extras = {} ---@type string[]
|
local extras = {} ---@type string[]
|
||||||
local defaults = LazyVim.config.get_defaults()
|
local defaults = LazyVim.config.get_defaults()
|
||||||
|
|
||||||
|
local changed = false
|
||||||
|
local updated = {} ---@type string[]
|
||||||
|
|
||||||
-- Add extras from LazyExtras that are not disabled
|
-- Add extras from LazyExtras that are not disabled
|
||||||
for _, extra in ipairs(LazyVim.config.json.data.extras) do
|
for _, extra in ipairs(LazyVim.config.json.data.extras) do
|
||||||
|
if LazyVim.plugin.renamed_extras[extra] then
|
||||||
|
extra = LazyVim.plugin.renamed_extras[extra]
|
||||||
|
changed = true
|
||||||
|
end
|
||||||
|
if LazyVim.plugin.deprecated_extras[extra] then
|
||||||
|
changed = true
|
||||||
|
else
|
||||||
|
updated[#updated + 1] = extra
|
||||||
local def = defaults[extra]
|
local def = defaults[extra]
|
||||||
if not (def and def.enabled == false) then
|
if not (def and def.enabled == false) then
|
||||||
extras[#extras + 1] = extra
|
extras[#extras + 1] = extra
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if changed then
|
||||||
|
LazyVim.config.json.data.extras = updated
|
||||||
|
LazyVim.json.save()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add default extras
|
-- Add default extras
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue