diff --git a/lua/cyberdream/config.lua b/lua/cyberdream/config.lua index 58a27b3..9f2d99c 100644 --- a/lua/cyberdream/config.lua +++ b/lua/cyberdream/config.lua @@ -106,9 +106,55 @@ local default_options = { ---@type Config M.options = {} +-- TODO: Remove post v5.0.0 +local function notify_deprecation(old_option, new_option) + vim.defer_fn(function() + vim.notify( + string.format("The '%s' is deprecated!\n\nUse '%s' instead.", old_option, new_option), + 3, + { title = "cyberdream.nvim" } + ) + end, 1000) +end + +-- TODO: Remove post v5.0.0 +local function handle_theme_deprecation(options) + if not options.theme then + return options + end + + notify_deprecation("theme table", "root table") + + local theme_mappings = { + variant = true, + saturation = true, + colors = true, + highlights = true, + overrides = true, + } + + for key in pairs(theme_mappings) do + if options.theme[key] then + options[key] = options.theme[key] + end + end + + return options +end + ---@param options Config|nil function M.setup(options) - M.options = vim.tbl_deep_extend("force", {}, default_options, options or {}) + options = options or {} + ---@diagnostic disable: undefined-field + if options.borderless_telescope ~= nil then + notify_deprecation("borderless_telescope", "borderless_pickers") + options.borderless_pickers = options.borderless_telescope + end + ---@diagnostic enable: undefined-field + options = handle_theme_deprecation(options) + + --- TODO: Delete everything above post v5.0.0 + M.options = vim.tbl_deep_extend("force", {}, default_options, options) vim.g.cyberdream_opts = M.options end