Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Search doesn't exclude gitignored files #45487
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:
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
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
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:
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
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.