diff --git a/lua/nvim-tree/diagnostics.lua b/lua/nvim-tree/diagnostics.lua index 3771779def3..09c2b12df92 100644 --- a/lua/nvim-tree/diagnostics.lua +++ b/lua/nvim-tree/diagnostics.lua @@ -108,13 +108,18 @@ function M.update() end for bufname, severity in pairs(buffer_severity) do - local bufpath = utils.canonical_path(bufname) + local bufpath = vim.fn.fnamemodify(utils.canonical_path(bufname), ":p") log.line("diagnostics", " bufpath '%s' severity %d", bufpath, severity) if 0 < severity and severity < 5 then for line, node in pairs(nodes_by_line) do - local nodepath = utils.canonical_path(node.absolute_path) + local nodepath = vim.fn.fnamemodify(utils.canonical_path(node.absolute_path), ":p") log.line("diagnostics", " %d checking nodepath '%s'", line, nodepath) - if M.show_on_dirs and vim.startswith(bufpath, nodepath) and (not node.open or M.show_on_open_dirs) then + if + M.show_on_dirs + and node.nodes + and vim.startswith(bufpath, nodepath) + and (not node.open or M.show_on_open_dirs) + then log.line("diagnostics", " matched fold node '%s'", node.absolute_path) node.diag_status = severity add_sign(line, severity)