show diagnostics on parent dirs if nodes with diagnostics are not visible (#862)
This commit is contained in:
parent
bb12c70367
commit
239f2d6fea
@ -85,6 +85,7 @@ function.
|
||||
update_cwd = false,
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
@ -231,6 +232,11 @@ Here is a list of the options available in the setup call:
|
||||
type: `boolean`
|
||||
default: `false`
|
||||
|
||||
- diagnostics.show_on_dirs: if the node with diagnostic is not visible,
|
||||
then show diagnostic in the parent directory
|
||||
type: `boolean`
|
||||
default: `false`
|
||||
|
||||
- |diagnostics.icons|: icons for diagnostic severity
|
||||
type: `table`
|
||||
default: `{ hint = "", info = "", warning = "", error = "" }`
|
||||
|
||||
@ -431,6 +431,7 @@ local DEFAULT_OPTS = {
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
|
||||
@ -125,7 +125,11 @@ function M.update()
|
||||
for bufname, severity in pairs(buffer_severity) do
|
||||
if 0 < severity and severity < 5 then
|
||||
local node, line = utils.find_node(nodes, function(node)
|
||||
if M.show_on_dirs and not node.open then
|
||||
return vim.startswith(bufname, node.absolute_path)
|
||||
else
|
||||
return node.absolute_path == bufname
|
||||
end
|
||||
end)
|
||||
if node then add_sign(line, severity) end
|
||||
end
|
||||
@ -142,6 +146,7 @@ local links = {
|
||||
|
||||
function M.setup(opts)
|
||||
M.enable = opts.diagnostics.enable
|
||||
M.show_on_dirs = opts.diagnostics.show_on_dirs
|
||||
vim.fn.sign_define(sign_names[1][1], { text = opts.diagnostics.icons.error, texthl = sign_names[1][2] })
|
||||
vim.fn.sign_define(sign_names[2][1], { text = opts.diagnostics.icons.warning, texthl = sign_names[2][2] })
|
||||
vim.fn.sign_define(sign_names[3][1], { text = opts.diagnostics.icons.info, texthl = sign_names[3][2] })
|
||||
|
||||
Loading…
Reference in New Issue
Block a user