diff options
| author | kylo252 <[email protected]> | 2022-11-04 15:32:09 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-04 10:32:09 -0400 | 
| commit | 4841dc62c3505cbe90b17c867bde6bc4d2abbb56 (patch) | |
| tree | be91734db4f677b515a76d556780ca4eee033a49 | |
| parent | 778fae1950b8781bc611d3d5bfd1b8b701464e9b (diff) | |
refactor(config): better deprecation handling (#3419)
| -rw-r--r-- | lua/lvim/config/init.lua | 84 | 
1 files changed, 1 insertions, 83 deletions
| diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 4f950beb..a7b3d0c8 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -29,93 +29,13 @@ function M:init()    local lvim_lsp_config = require "lvim.lsp.config"    lvim.lsp = vim.deepcopy(lvim_lsp_config) -  ---@deprecated replaced with lvim.builtin.alpha -  lvim.builtin.dashboard = { -    active = false, -    on_config_done = nil, -    search_handler = "", -    disable_at_vim_enter = 0, -    session_directory = "", -    custom_header = {}, -    custom_section = {}, -    footer = {}, -  } -    lvim.builtin.luasnip = {      sources = {        friendly_snippets = true,      },    } -  ---@deprecated -  lvim.builtin.notify = { -    active = false, -  } -end - -local function handle_deprecated_settings() -  local function deprecation_notice(setting, new_setting) -    local in_headless = #vim.api.nvim_list_uis() == 0 -    if in_headless then -      return -    end - -    local msg = string.format( -      "Deprecation notice: [%s] setting is no longer supported. %s", -      setting, -      new_setting or "See https://github.com/LunarVim/LunarVim#breaking-changes" -    ) -    vim.schedule(function() -      vim.notify_once(msg, vim.log.levels.WARN) -    end) -  end - -  ---lvim.lang.FOO.lsp -  for lang, entry in pairs(lvim.lang) do -    local deprecated_config = entry.formatters or entry.linters or {} -    if not vim.tbl_isempty(deprecated_config) then -      deprecation_notice(string.format("lvim.lang.%s", lang)) -    end -  end - -  -- lvim.lsp.override -  if lvim.lsp.override and not vim.tbl_isempty(lvim.lsp.override) then -    deprecation_notice("lvim.lsp.override", "Use `lvim.lsp.automatic_configuration.skipped_servers` instead") -    vim.tbl_map(function(c) -      if not vim.tbl_contains(lvim.lsp.automatic_configuration.skipped_servers, c) then -        table.insert(lvim.lsp.automatic_configuration.skipped_servers, c) -      end -    end, lvim.lsp.override) -  end - -  -- lvim.lsp.popup_border -  if vim.tbl_contains(vim.tbl_keys(lvim.lsp), "popup_border") then -    deprecation_notice "lvim.lsp.popup_border" -  end - -  -- dashboard.nvim -  if lvim.builtin.dashboard.active then -    deprecation_notice("lvim.builtin.dashboard", "Use `lvim.builtin.alpha` instead. See LunarVim#1906") -  end - -  -- notify.nvim -  if lvim.builtin.notify.active then -    deprecation_notice("lvim.builtin.notify", "See LunarVim#3294") -  end - -  if lvim.autocommands.custom_groups then -    deprecation_notice( -      "lvim.autocommands.custom_groups", -      "Use vim.api.nvim_create_autocmd instead or check LunarVim#2592 to learn about the new syntax" -    ) -  end - -  if lvim.lsp.automatic_servers_installation then -    deprecation_notice( -      "lvim.lsp.automatic_servers_installation", -      "Use `lvim.lsp.installer.setup.automatic_installation` instead" -    ) -  end +  require("lvim.config._deprecated").handle()  end  --- Override the configuration with a user provided one @@ -138,8 +58,6 @@ function M:load(config_path)    Log:set_level(lvim.log.level) -  handle_deprecated_settings() -    autocmds.define_autocmds(lvim.autocommands)    vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader | 
