From ecb25de2609d33981010007224b6f386b98cdf27 Mon Sep 17 00:00:00 2001 From: ray-x Date: Wed, 22 Sep 2021 19:46:24 +1000 Subject: [PATCH] rename disable_format_ft to disable_format_cap --- README.md | 3 ++- lua/navigator.lua | 10 +++++++++- lua/navigator/lspclient/clients.lua | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 663d9fb..b4ad789 100644 --- a/README.md +++ b/README.md @@ -229,11 +229,12 @@ require'navigator'.setup({ lsp = { format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc) - disable_format_ft = {"sqls", "sumneko_lua", "gopls"}, -- a list of lsp not enable auto-format (e.g. if you using efm or vim-codeformat etc), empty by default + disable_format_cap = {"sqls", "sumneko_lua", "gopls"}, -- a list of lsp disable format capacity (e.g. if you using efm or vim-codeformat etc), empty {} by default disable_lsp = {'pylsd', 'sqlls'}, -- a list of lsp server disabled for your project, e.g. denols and tsserver you may -- only want to enable one lsp server -- to disable all default config and use your own lsp setup set -- disable_lsp = 'all' + -- Default {} diagnostic_scroll_bar_sign = {'▃', '█'}, -- experimental: diagnostic status in scroll bar area; set to nil to disable the diagnostic sign, -- for other style, set to {'╍', 'ﮆ'} or {'-', '='} diagnostic_virtual_text = true, -- show virtual for diagnostic message diff --git a/lua/navigator.lua b/lua/navigator.lua index bd2566d..295b68b 100644 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -25,7 +25,7 @@ _NgConfigValues = { -- setup here. if it is nil, navigator will not init signature help lsp = { format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc) - disable_format_ft = {}, -- a list of lsp not enable auto-format (e.g. if you using efm or vim-codeformat etc), empty by default + disable_format_cap = {}, -- a list of lsp disable file format (e.g. if you using efm or vim-codeformat etc), empty by default disable_lsp = nil, -- a list of lsp server disabled for your project, e.g. denols and tsserver you may code_lens = false, -- only want to enable one lsp server @@ -88,11 +88,19 @@ vim.cmd("command! -nargs=0 LspRestart lua require'navigator.lspclient.config'.re vim.cmd( "command! -nargs=0 LspToggleFmt lua require'navigator.lspclient.mapping'.toggle_lspformat()") +M.deprecated = function(cfg) + local warn = require'navigator.util'.warn + if cfg.lsp ~= nil and cfg.lsp.disable_format_ft ~= nil and cfg.lsp.disable_format_ft ~= {} then + warn('disable_format_ft renamed to disable_format_cap') + end +end + local extend_config = function(opts) opts = opts or {} if next(opts) == nil then return end + M.deprecated(opts) for key, value in pairs(opts) do -- if _NgConfigValues[key] == nil then -- error(string.format("[] Key %s not valid", key)) diff --git a/lua/navigator/lspclient/clients.lua b/lua/navigator/lspclient/clients.lua index 9b2c11e..9617712 100644 --- a/lua/navigator/lspclient/clients.lua +++ b/lua/navigator/lspclient/clients.lua @@ -377,8 +377,8 @@ local function wait_lsp_startup(ft, retry, user_lsp_opts) -- log(lsp_opts[lspclient], cfg) local disable_fmt = false - log(lspclient, config.lsp.disable_format_ft) - if vim.tbl_contains(config.lsp.disable_format_ft or {}, lspclient) then + log(lspclient, config.lsp.disable_format_cap) + if vim.tbl_contains(config.lsp.disable_format_cap or {}, lspclient) then log("fileformat disabled for ", lspclient) disable_fmt = true end