deprecate vim.lsp.diagnostic

pull/268/head
ray-x 1 year ago
parent a801cf6b25
commit 1fcb0045d1

@ -409,7 +409,7 @@ M.show_buf_diagnostics = function()
end end
-- set loc list win -- set loc list win
M.set_diag_loclist = function(bufnr) M.setloclist = function(bufnr)
bufnr = bufnr or api.nvim_get_current_buf() bufnr = bufnr or api.nvim_get_current_buf()
local diag_cnt = get_count(bufnr, [[Error]]) + get_count(bufnr, [[Warning]]) local diag_cnt = get_count(bufnr, [[Error]]) + get_count(bufnr, [[Warning]])
if diag_cnt == 0 then if diag_cnt == 0 then
@ -429,13 +429,8 @@ M.set_diag_loclist = function(bufnr)
if not vim.tbl_isempty(vim.lsp.get_active_clients({ buffer = bufnr })) then if not vim.tbl_isempty(vim.lsp.get_active_clients({ buffer = bufnr })) then
local err_cnt = get_count(0, [[Error]]) local err_cnt = get_count(0, [[Error]])
if err_cnt > 0 and _NgConfigValues.lsp.disply_diagnostic_qf then if err_cnt > 0 and _NgConfigValues.lsp.disply_diagnostic_qf then
if not diagnostic.set_loclist then cfg.namespaces = diagnostic.get_namespaces()
vim.notify('deprecated: please update nvim to 0.7+') diagnostic.setloclist(cfg)
diagnostic.set_loclist(cfg)
else
cfg.namespaces = diagnostic.get_namespaces()
diagnostic.setloclist(cfg)
end
else else
vim.cmd('lclose') vim.cmd('lclose')
end end
@ -565,6 +560,10 @@ function M.config(cfg)
end end
cfg = vim.tbl_extend('keep', cfg, default_cfg) cfg = vim.tbl_extend('keep', cfg, default_cfg)
if vim.diagnostic == nil then
vim.notify('deprecated: please update nvim to 0.7+')
return
end
vim.diagnostic.config(cfg) vim.diagnostic.config(cfg)
end end

@ -399,7 +399,7 @@ function M.setup(attach_opts)
buffer = attach_opts.bufnr, buffer = attach_opts.bufnr,
desc = 'diagnostic update', desc = 'diagnostic update',
callback = function() callback = function()
require('navigator.diagnostics').set_diag_loclist(attach_opts.bufnr) require('navigator.diagnostics').setloclist(attach_opts.bufnr)
end, end,
}) })

Loading…
Cancel
Save