-
Notifications
You must be signed in to change notification settings - Fork 36k
Enable case-insensitive ignore files #274232
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
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.
Pull Request Overview
This PR adds case-insensitive matching support to the IgnoreFile class for handling ignore files (like .gitignore). This allows paths to be matched against ignore patterns regardless of case when the ignoreCase flag is enabled.
Key changes:
- Added an
ignoreCaseparameter to the IgnoreFile constructor and propagated it through the matching logic - Updated string comparison to use
startsWithIgnoreCasewhen case-insensitive matching is enabled - Added comprehensive test coverage for case-insensitive ignore file matching
- Fixed several spelling errors in comments ("Preservering" → "Preserving", "expectred" → "expected", "ouside" → "outside", "naieve" → "naive")
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/workbench/services/search/common/ignoreFile.ts | Added ignoreCase parameter to constructor, imported startsWithIgnoreCase utility, updated path matching logic to support case-insensitive comparisons, and fixed spelling errors in comments |
| src/vs/workbench/services/search/test/common/ignoreFile.test.ts | Updated test helper functions to accept ignoreCase parameter and added new test suite for case-insensitive matching scenarios |
Comments suppressed due to low confidence (1)
src/vs/workbench/services/search/common/ignoreFile.ts:32
- The
updateContentsmethod doesn't preserve theignoreCasesetting when re-parsing the ignore file. This could cause the ignore file to switch from case-insensitive to case-sensitive (or vice versa) after an update. TheparseIgnoreFilecall should passthis.ignoreCaseto maintain consistency, or the internalisPathIgnoredfunction should close overthis.ignoreCaseproperly.
updateContents(contents: string) {
this.isPathIgnored = this.parseIgnoreFile(contents, this.location, this.parent);
Add
ignoreCaseoption to constructor and use case-insensitive glob API to support it. Added some unit-tests as well.Contributes towards fixing #10633.