[Draft] Respect gitignore file when file watching (fixes #231140) #246661
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #231140, this should reduce the amount of file watching happening on large repositories and less triggering of git status.
This will read the .gitignore file and fetch the values which can then be passed to the file watcher, however, it does seem like the filewatcher only accepts a single glob pattern, so there doesn't seem to be a way for me to watch the directory but exclude the paths from the
.gitignore
.@lszomoru do you have any idea on how to fix this or if there is a workaround?
For now on vscode's repo the pattern that gets passed through to the watcher looks like this:
My assumtion for this not working is the
**/*
at the beginning is matching, however if i take that out of the group match and have it at the start, then followed by the group match nothing matches. So it doesn't look like VS Code's built in glob allows for both checks here (or maybe im using it wrong)The same doesn't seem to work on the glob playground with parenthesis due to
/
being used in the patterns:https://www.digitalocean.com/community/tools/glob?comments=true&glob=%2A%2A%2F%21%28.DS_Store%7C.cache%7Cnpm-debug.log%7CThumbs.db%7Cnode_modules%2F%7C.build%2F%7C.vscode%2Fextensions%2F%2A%2A%2Fout%2F%7Cextensions%2F%2A%2A%2Fdist%2F%7C%2Fout%2A%2F%7C%2Fextensions%2F%2A%2A%2Fout%2F%7Cbuild%2Fnode_modules%7Ccoverage%2F%7Ctest_data%2F%7Ctest-results%2F%7Ctest-results.xml%7Cvscode.lsif%7Cvscode.db%7C%2F.profile-oss%7C%2Fcli%2Ftarget%7C%2Fcli%2Fopenssl%7Cproduct.overrides.json%7C%2A.snap.actual%7C.vscode-test%29&matches=false&tests=positive-match.jpg&tests=npm-debug.log&tests=Thumbs.d%C2%A0&tests=this-should-match.txt
Steps to reproduce
onChange
handler will fire (it shouldn't)