fix(diagnostics): do not show on file/dir with same prefix (#1832)
* fix diagnostics showing up on file/dir with same prefix * using fnamemodify instead of gsub
This commit is contained in:
@@ -108,13 +108,18 @@ function M.update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for bufname, severity in pairs(buffer_severity) do
|
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)
|
log.line("diagnostics", " bufpath '%s' severity %d", bufpath, severity)
|
||||||
if 0 < severity and severity < 5 then
|
if 0 < severity and severity < 5 then
|
||||||
for line, node in pairs(nodes_by_line) do
|
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)
|
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)
|
log.line("diagnostics", " matched fold node '%s'", node.absolute_path)
|
||||||
node.diag_status = severity
|
node.diag_status = severity
|
||||||
add_sign(line, severity)
|
add_sign(line, severity)
|
||||||
|
|||||||
Reference in New Issue
Block a user