fix(diagnostics): do not show on file/dir with same prefix

This commit is contained in:
Alexander Courtis 2022-12-23 12:44:30 +11:00
parent 3000797e53
commit fee6801393

View File

@ -108,16 +108,15 @@ function M.update()
end
for bufname, severity in pairs(buffer_severity) do
local bufpath = vim.fn.fnamemodify(utils.canonical_path(bufname), ":p")
local bufpath = utils.canonical_path(bufname)
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 = vim.fn.fnamemodify(utils.canonical_path(node.absolute_path), ":p")
local nodepath = utils.canonical_path(node.absolute_path)
log.line("diagnostics", " %d checking nodepath '%s'", line, nodepath)
if
M.show_on_dirs
and node.nodes
and vim.startswith(bufpath, nodepath)
and vim.startswith(bufpath:gsub("\\", "/"), nodepath:gsub("\\", "/") .. "/")
and (not node.open or M.show_on_open_dirs)
then
log.line("diagnostics", " matched fold node '%s'", node.absolute_path)