Skip to content

fix diagnostics showing up on file/dir with same prefix #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lua/nvim-tree/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down