-
-
Notifications
You must be signed in to change notification settings - Fork 626
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
Conversation
Hmmmmm now that I look at it |
Unfortunately I am out of time; I'll get to this one on the weekend. |
startswith is very useful. I should use that more. It looks like we do need |
Looks like startswith is a winner: it doesn't match any vim or lua patterns. Much simpler than string.find plain. local needle = "/cc"
local haystack = "/cc/dd/ee"
log.line("dev", "needle '%s' haystack '%s' startswith %s", needle, haystack, vim.startswith(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' vim.fn.match %s", needle, haystack, vim.fn.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.match %s", needle, haystack, string.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle, 1, true))
log.line("dev", "")
needle = "c:\\cc"
haystack = "c:\\cc\\dd\\ee"
log.line("dev", "needle '%s' haystack '%s' startswith %s", needle, haystack, vim.startswith(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' vim.fn.match %s", needle, haystack, vim.fn.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.match %s", needle, haystack, string.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle, 1, true))
log.line("dev", "")
needle = "c:\\.c"
haystack = "c:\\cc\\dd\\ee"
log.line("dev", "needle '%s' haystack '%s' startswith %s", needle, haystack, vim.startswith(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' vim.fn.match %s", needle, haystack, vim.fn.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.match %s", needle, haystack, string.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle, 1, true))
log.line("dev", "")
needle = "c:\\%ac"
haystack = "c:\\cc\\dd\\ee"
log.line("dev", "needle '%s' haystack '%s' startswith %s", needle, haystack, vim.startswith(haystack, needle))
-- log.line("dev", "needle '%s' haystack '%s' vim.fn.match %s", needle, haystack, vim.fn.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.match %s", needle, haystack, string.match(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle))
log.line("dev", "needle '%s' haystack '%s' string.find %s", needle, haystack, string.find(haystack, needle, 1, true))
|
The key part is the gsub works even for crazy paths like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested OK:
nvim-tree.lua/lua
show_on_dirs show_on_open_dirs
- false false
- true false
- false true
- true true
nvim-tree/lua\lua
as above
If A's path is B's prefix, then diagnostics in B will show up in both of them. For example, if there's diagnostics for
lua/nvim-tree.lua
,lua/nvim-tree/
will also show diagnostics even though non of it's children have any.This PR fixes that.