-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Make rust-analyzer.files.excludeDirs
work, actually
#18998
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
The original logic still looks correct to me! It handles nested entries. If root B is nested under A, and C is excluded, then, while scanning A:
That is, there’s an outer loop over A and B anyway. Without this exclusion, B will be scanned twice |
2e410cc
to
ab48e3d
Compare
Okay, so the logic needs to be: dirs.exclude.iter().all(|it| it != path) && (root == path || dirs.include.iter().all(|it| it != path)) |
To make sure I understand correctly, what happens here is that the same path ends up in exclude (explicitly configured by the user) and also in the include (I am guessing through auto-discovery mechanism)? 🤔 Should be perhaps push the if up here? In VFS, we can assert that neither path is simultaneously in the inclusion and exclusion list. In the project-discovery code, we can explicitly exclude the excluded directories. Unrelated, but, due to a bug in GitHub, it is best not to include @-mentions in the commit messages. GitHub incorrectly sends a email-notification every time such a commit is pushed, including rebases and forks. Pings in PR descriptions are totally fine and encouraged! |
ab48e3d
to
5e2b692
Compare
Yes, exactly.
I don't think, I think it's fine as it's now.
Didn't know, sorry! I edited the commit message. |
I have no idea what the original writer of the code thought but the logic just seems backwards. We should not exclude a file/directory if it is equal to an include! This also meant that we had to add a `root == path` check so this stuff will actually work, which in turn meant excludes (of root files) no longer worked... Also rename if to `rust-analyzer.files.exclude`, because it can exclude files as well.
5e2b692
to
e9382bf
Compare
Okay this is now ready for review. |
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.
Unfortunate that we have to encode this specially in the VFS (and then effectively handle in every request handler), but it does make sense as to why (and I can't think of a different way to do this either)
This require a pretty big modification, because this is a new kind of file: exists - but ignore it.
e9382bf
to
549b49f
Compare
Ping, kind of waiting for this (I think it'll solve my "Roots scanned" issue), and wanted to ask when it can/will be merged? thanks! :) |
Forgot about this, should be good to merge :) |
Awesome, thank you! 🚀 |
I have no idea what the original writer of the code thought (CC @matklad, I don't expect you to remember but it was you), but the logic just seems backwards. We should not exclude a file/directory if it is equal to an include! This also meant that we had to add a
root == path
check so this stuff will actually work, which in turn meant excludes (of root files) no longer worked...Also rename if to
rust-analyzer.files.exclude
, because it can exclude files as well.Fixes #14734.