fix: config.setup deprecation checks

main
olimorris 2023-02-23 10:41:21 +00:00
parent aa3fdbc8a5
commit 029ba65f39
1 changed files with 68 additions and 66 deletions

View File

@ -37,73 +37,75 @@ function M.setup(opts)
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {}) M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})
vim.fn.mkdir(M.options.save_dir, "p") vim.fn.mkdir(M.options.save_dir, "p")
if opts.before_source then if opts then
require("persisted.deprecate").write( if opts.before_source then
"----------\n", require("persisted.deprecate").write(
"The use of the ", "----------\n",
{ "before_source", "ErrorMsg" }, "The use of the ",
" callback.\nPlease replace with the ", { "before_source", "ErrorMsg" },
{ "PersistedLoadPre", "WarningMsg" }, " callback.\nPlease replace with the ",
{ " user event. This will be removed from the plugin on " }, { "PersistedLoadPre", "WarningMsg" },
{ "2023-03-05", "WarningMsg" } { " user event. This will be removed from the plugin on " },
) { "2023-03-05", "WarningMsg" }
end )
if opts.after_source then end
require("persisted.deprecate").write( if opts.after_source then
"----------\n", require("persisted.deprecate").write(
"The use of the ", "----------\n",
{ "after_source", "ErrorMsg" }, "The use of the ",
" callback.\nPlease replace with the ", { "after_source", "ErrorMsg" },
{ "PersistedLoadPost", "WarningMsg" }, " callback.\nPlease replace with the ",
{ " user event. This will be removed from the plugin on " }, { "PersistedLoadPost", "WarningMsg" },
{ "2023-03-05", "WarningMsg" } { " user event. This will be removed from the plugin on " },
) { "2023-03-05", "WarningMsg" }
end )
if opts.before_save then end
require("persisted.deprecate").write( if opts.before_save then
"----------\n", require("persisted.deprecate").write(
"The use of the ", "----------\n",
{ "before_save", "ErrorMsg" }, "The use of the ",
" callback.\nPlease replace with the ", { "before_save", "ErrorMsg" },
{ "PersistedSavePre", "WarningMsg" }, " callback.\nPlease replace with the ",
{ " user event. This will be removed from the plugin on " }, { "PersistedSavePre", "WarningMsg" },
{ "2023-03-05", "WarningMsg" } { " user event. This will be removed from the plugin on " },
) { "2023-03-05", "WarningMsg" }
end )
if opts.after_save then end
require("persisted.deprecate").write( if opts.after_save then
"----------\n", require("persisted.deprecate").write(
"The use of the ", "----------\n",
{ "after_save", "ErrorMsg" }, "The use of the ",
" callback.\nPlease replace with the ", { "after_save", "ErrorMsg" },
{ "PersistedSavePost", "WarningMsg" }, " callback.\nPlease replace with the ",
{ " user event. This will be removed from the plugin on " }, { "PersistedSavePost", "WarningMsg" },
{ "2023-03-05", "WarningMsg" } { " user event. This will be removed from the plugin on " },
) { "2023-03-05", "WarningMsg" }
end )
end
-- Telescope -- Telescope
if opts.telescope and opts.telescope.before_source then if opts.telescope and opts.telescope.before_source then
require("persisted.deprecate").write( require("persisted.deprecate").write(
"----------\n", "----------\n",
"The use of the ", "The use of the ",
{ "telescope.before_source", "ErrorMsg" }, { "telescope.before_source", "ErrorMsg" },
" callback.\nPlease replace with the ", " callback.\nPlease replace with the ",
{ "PersistedTelescopeLoadPre", "WarningMsg" }, { "PersistedTelescopeLoadPre", "WarningMsg" },
{ " user event. This will be removed from the plugin on "}, { " user event. This will be removed from the plugin on " },
{ "2023-03-05", "WarningMsg" } { "2023-03-05", "WarningMsg" }
) )
end end
if opts.telescope and opts.telescope.after_source then if opts.telescope and opts.telescope.after_source then
require("persisted.deprecate").write( require("persisted.deprecate").write(
"----------\n", "----------\n",
"The use of the ", "The use of the ",
{ "telescope.after_source", "ErrorMsg" }, { "telescope.after_source", "ErrorMsg" },
" callback.\nPlease replace with the ", " callback.\nPlease replace with the ",
{ "PersistedTelescopeLoadPost", "WarningMsg" }, { "PersistedTelescopeLoadPost", "WarningMsg" },
{ " user event. This will be removed from the plugin on "}, { " user event. This will be removed from the plugin on " },
{ "2023-03-05", "WarningMsg" } { "2023-03-05", "WarningMsg" }
) )
end
end end
end end