|
|
|
@ -239,6 +239,9 @@ local diag_hdlr = function(err, result, ctx, config)
|
|
|
|
|
else
|
|
|
|
|
v.severity = 2
|
|
|
|
|
end
|
|
|
|
|
if not _NgConfigValues.icons.icons then
|
|
|
|
|
head = ''
|
|
|
|
|
end
|
|
|
|
|
if v.relatedInformation and v.relatedInformation[1] then
|
|
|
|
|
local info = v.relatedInformation[1]
|
|
|
|
|
-- trace(info)
|
|
|
|
@ -251,6 +254,11 @@ local diag_hdlr = function(err, result, ctx, config)
|
|
|
|
|
end
|
|
|
|
|
local bufnr1 = vim.uri_to_bufnr(uri)
|
|
|
|
|
local loaded = api.nvim_buf_is_loaded(bufnr1)
|
|
|
|
|
local ic = _NgConfigValues.icons.diagnostic_head_description
|
|
|
|
|
if not _NgConfigValues.icons.icons then
|
|
|
|
|
ic = ''
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if _NgConfigValues.diagnostic_load_files then
|
|
|
|
|
-- print('load buffers')
|
|
|
|
|
if not loaded then
|
|
|
|
@ -260,12 +268,12 @@ local diag_hdlr = function(err, result, ctx, config)
|
|
|
|
|
local row = pos.line
|
|
|
|
|
local line = (api.nvim_buf_get_lines(bufnr1, row, row + 1, false) or { '' })[1]
|
|
|
|
|
if line ~= nil then
|
|
|
|
|
item.text = head .. line .. _NgConfigValues.icons.diagnostic_head_description .. v.message
|
|
|
|
|
item.text = head .. line .. ic .. v.message
|
|
|
|
|
else
|
|
|
|
|
error('diagnostic result empty line', v, row, bufnr1)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
item.text = head .. _NgConfigValues.icons.diagnostic_head_description .. v.message
|
|
|
|
|
item.text = head .. ic .. v.message
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if v.releated_msg then
|
|
|
|
@ -547,9 +555,12 @@ function M.config(cfg)
|
|
|
|
|
local default_cfg = {
|
|
|
|
|
underline = true,
|
|
|
|
|
virtual_text = true,
|
|
|
|
|
signs = { _NgConfigValues.icons.diagnostic_err },
|
|
|
|
|
update_in_insert = false,
|
|
|
|
|
}
|
|
|
|
|
if _NgConfigValues.icons then
|
|
|
|
|
default_cfg.signs = { _NgConfigValues.icons.diagnostic_err }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
cfg = vim.tbl_extend('keep', cfg, default_cfg)
|
|
|
|
|
vim.diagnostic.config(cfg)
|
|
|
|
|
end
|
|
|
|
|