mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
fix(deprecation): only deprecate tag == "*"
in lvim.plugins (#4297)
This commit is contained in:
parent
e7ce9522d7
commit
84737b1573
1 changed files with 29 additions and 17 deletions
|
@ -110,10 +110,16 @@ function M.post_load()
|
||||||
opt = "lazy",
|
opt = "lazy",
|
||||||
run = "build",
|
run = "build",
|
||||||
lock = "pin",
|
lock = "pin",
|
||||||
tag = "version",
|
|
||||||
requires = "dependencies",
|
requires = "dependencies",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alternatives.tag = function()
|
||||||
|
if spec.tag == "*" then
|
||||||
|
spec.version = "*"
|
||||||
|
return [[version = "*"]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
alternatives.disable = function()
|
alternatives.disable = function()
|
||||||
if type(spec.disabled) == "function" then
|
if type(spec.disabled) == "function" then
|
||||||
spec.enabled = function()
|
spec.enabled = function()
|
||||||
|
@ -138,34 +144,40 @@ function M.post_load()
|
||||||
for old_key, alternative in pairs(alternatives) do
|
for old_key, alternative in pairs(alternatives) do
|
||||||
if spec[old_key] ~= nil then
|
if spec[old_key] ~= nil then
|
||||||
local message
|
local message
|
||||||
|
local old_value = vim.inspect(spec[old_key]) or "value"
|
||||||
|
|
||||||
if type(alternative) == "function" then
|
if type(alternative) == "function" then
|
||||||
message = alternative()
|
message = alternative()
|
||||||
else
|
else
|
||||||
spec[alternative] = spec[old_key]
|
spec[alternative] = spec[old_key]
|
||||||
end
|
end
|
||||||
spec[old_key] = nil
|
|
||||||
|
|
||||||
local new_value = vim.inspect(spec[alternative] or "[value]")
|
-- not every function in alternatives returns a message (e.g. tag)
|
||||||
message = message or string.format("%s = %s", alternative, new_value)
|
if type(alternative) ~= "function" or message then
|
||||||
vim.schedule(function()
|
spec[old_key] = nil
|
||||||
vim.notify_once(
|
|
||||||
string.format(
|
local new_value = vim.inspect(spec[alternative] or "[value]")
|
||||||
[[`%s` in `lvim.plugins` has been deprecated since the migration to lazy.nvim. Use `%s` instead.
|
message = message or string.format("%s = %s", alternative, new_value)
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.notify_once(
|
||||||
|
string.format(
|
||||||
|
[[`%s = %s` in `lvim.plugins` has been deprecated since the migration to lazy.nvim. Use `%s` instead.
|
||||||
Example:
|
Example:
|
||||||
`lvim.plugins = {... {... %s = %s ...} ...}`
|
`lvim.plugins = {... {... %s = %s ...} ...}`
|
||||||
->
|
->
|
||||||
`lvim.plugins = {... {... %s ...} ...}`
|
`lvim.plugins = {... {... %s ...} ...}`
|
||||||
See https://github.com/folke/lazy.nvim#-migration-guide"]],
|
See https://github.com/folke/lazy.nvim#-migration-guide"]],
|
||||||
old_key,
|
old_key,
|
||||||
message,
|
old_value,
|
||||||
old_key,
|
message,
|
||||||
new_value,
|
old_key,
|
||||||
message
|
old_value,
|
||||||
),
|
message
|
||||||
vim.log.levels.WARN
|
),
|
||||||
)
|
vim.log.levels.WARN
|
||||||
end)
|
)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue