-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Search doesn't exclude gitignored files #45487
Comments
Confirmed by a colleague on a Mac, VSCode 1.21.1. |
Any clue what's different about the files in .cache that are correctly excluded vs the ones that aren't? Is it the same set every time? |
I found out what is causing it: the fact that I want to search in a specific folder in our monorepo (the folder is Our monorepo has a structure like this:
My goal is to search inside |
Seems that ripgrep doesn't look at child .gitignore files as it searches. Does using |
Yes although I'm not sure the results are as expected. I created this repo so that you can try yourself: https://github.com/borekb/vscode-search-issue-45487 Some screenshots: This is how the structure looks: All four .txt files contain the same thing, a string "hello". Plain search works as expected: Scoping to just "a" doesn't work: Scoping to "./a" works better but looks differently, for example, the small gray "a" is missing from the search result: Including both folders makes this more apparent, especially compared to the original result: |
Thanks for the tip about |
Actually it's not what I said before, this is about the include pattern overriding the gitignore file, which ripgrep does. The result format is what I expect - that syntax roots the search in that folder, rather than searching from the open folder, with the given folder name as Will have to play with this some more, I don't think glob patterns should override the gitignore file. |
In VSCode 1.22.2 the issue which you originally mentioned does exist @roblourens. Search is finding results in files which should be ignored by sub .gitignore files. It seems that only the root .gitignore is being used and the others are being ignored. A standard Laravel project contains the structure:
Everything in the As a note, the project explorer itself is correctly dimming the ignored |
Are you sure @jameshulse? Like @borekb said,
And that's what I saw. So I don't think child .gitignore files are ignored entirely. If you have an include pattern, it might override the gitignore file. |
Hopefully these screenshots will show the issue. I am searching for some arbitrary text in one of the ignored cache files in my project. Nothing in the include / exclude patterns box and results are the same whether I have the "Exclude settings" toggle on or off. The nearest .gitignore simply has:
Let me know if there is anything else I can provide. |
It looks like that file was open before you searched - open files can still be searched even when they should be excluded. That's another bug: #31819 |
Good catch. I think you might be right - I'm not sure how I originally came across the issue now, but I might have had an inclusion string set. Sorry for the time waste, I really appreciate all your team do on VS Code! |
I can confirm this is happening in 1.24.1 |
I believe this is actually a dupe of #26574 |
I just encountered a situation where "Use exclude settings and ignore files" is not honored:
This is strange because it usually works fine for me. Also, it has some effect because if I unclick the gear icon, I get different results:
I do not quite understand. I've tried in both current version and insiders, it behaves the same in both.
My main VSCode version:
My insiders version:
The text was updated successfully, but these errors were encountered: