breaking: issue #375 diagnostics.hdlr=false by default as complains about the qickfix when file saved \n the feature need to turn on manually

pull/390/head
ray-x 7 months ago
parent cb8b506373
commit 0a508516f1

File diff suppressed because it is too large Load Diff

@ -389,8 +389,15 @@ You can setup go.nvim with following options:
-- when lsp_cfg is true
lsp_keymaps = true, -- true: apply default lsp keymaps
lsp_codelens = true,
lsp_diag_hdlr = true, -- hook lsp diag handler
lsp_diag_virtual_text = { space = 0, prefix = '■' }, -- lsp virtual text format
diagnostic = { -- set diagnostic to false to disable vim.diagnostic setup
-- in go.nvim
hdlr = false, -- hook lsp diag handler and send diag to quickfix
underline = true,
-- virtual text setup
virtual_text = { space = 0, prefix = '■' },
signs = true,
update_in_insert = false,
},
lsp_inlay_hints = {
enable = true,

@ -43,7 +43,7 @@ _GO_NVIM_CFG = {
lsp_keymaps = true, -- true: use default keymaps defined in go/lsp.lua
lsp_codelens = true,
diagnostic = { -- set diagnostic to false to disable diagnostic
hdlr = true, -- hook diagnostic handler
hdlr = false, -- hook diagnostic handler and send error to quickfix
underline = true,
-- virtual text setup
virtual_text = { space = 0, prefix = '' },
@ -196,8 +196,9 @@ function go.setup(cfg)
signs = _GO_NVIM_CFG.diagnostic.signs,
update_in_insert = _GO_NVIM_CFG.diagnostic.update_in_insert,
})
if _GO_NVIM_CFG.diagnostic.hdlr then
require('go.lsp_diag')
if _GO_NVIM_CFG.diagnostic ~= false then
require('go.lsp_diag').setup()
end
end
vim.defer_fn(function()

@ -31,17 +31,24 @@ local function hdlr(result)
end
end
local diag_hdlr_0_6 = function(err, result, ctx, config)
-- vim.lsp.diagnostic.clear(vfn.bufnr(), client.id, nil, nil)
vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config)
hdlr(result)
end
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
diag_hdlr_0_6, {
underline = _GO_NVIM_CFG.diagnostic.underline,
virtual_text = _GO_NVIM_CFG.diagnostic.virtual_text,
signs = _GO_NVIM_CFG.diagnostic.signs,
update_in_insert = _GO_NVIM_CFG.diagnostic.update_in_insert,
}
)
return {
setup = function()
local _diag_hdlr
if _GO_NVIM_CFG.diagnostic.hdlr == true then
_diag_hdlr = function(err, result, ctx, config)
vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config)
hdlr(result)
end
else
diag_hdlr = vim.lsp.diagnostic.on_publish_diagnostics
end
return
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(diag_hdlr, {
underline = _GO_NVIM_CFG.diagnostic.underline,
virtual_text = _GO_NVIM_CFG.diagnostic.virtual_text,
signs = _GO_NVIM_CFG.diagnostic.signs,
update_in_insert = _GO_NVIM_CFG.diagnostic.update_in_insert,
})
end,
handler = diag_hdlr,
}

Loading…
Cancel
Save