Skip to content

Support case-insensitive glob#273837

Merged
dmitrivMS merged 7 commits intomainfrom
dev/dmitriv/glob-1
Oct 29, 2025
Merged

Support case-insensitive glob#273837
dmitrivMS merged 7 commits intomainfrom
dev/dmitriv/glob-1

Conversation

@dmitrivMS
Copy link
Contributor

@dmitrivMS dmitrivMS commented Oct 28, 2025

First step towards fixing #10633 and many related duplicates.

This PR adds an option to enable case-insensitive glob expressions and matching.
The new option is not used here and default behavior is the same as before.
The option will be used by follow up PRs to enable case-insensitive behavior in various features.

Copilot AI review requested due to automatic review settings October 28, 2025 22:26
@dmitrivMS dmitrivMS enabled auto-merge (squash) October 28, 2025 22:26
@dmitrivMS dmitrivMS self-assigned this Oct 28, 2025
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/base/common/glob.ts

@dmitrivMS
Copy link
Contributor Author

NOTE: I have file search working locally with this and other changes, but prefer to split the changes into multiple PRs for ease of review and/or discussions/feedback.

@dmitrivMS dmitrivMS linked an issue Oct 28, 2025 that may be closed by this pull request
@vs-code-engineering vs-code-engineering bot added this to the October 2025 milestone Oct 28, 2025
Copy link
Contributor

Copilot AI left a 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 glob pattern matching support to the VS Code glob utility. The implementation includes a new ignoreCase option for glob patterns and introduces several string comparison utility functions.

Key changes:

  • Added equals(), endsWithIgnoreCase() functions to the strings module and refactored startsWithIgnoreCase() for consistency
  • Extended glob matching API to support an ignoreCase option via IGlobOptions
  • Updated internal glob implementation to use case-insensitive comparison functions when ignoreCase is enabled
  • Added comprehensive test coverage for new string functions and case-insensitive glob matching

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/vs/base/common/strings.ts Adds equals() and endsWithIgnoreCase() functions, refactors startsWithIgnoreCase(), replaces deprecated substr() with substring()
src/vs/base/test/common/strings.test.ts Adds comprehensive tests for equals() and endsWithIgnoreCase() functions
src/vs/base/common/glob.ts Implements case-insensitive glob matching by adding ignoreCase option, updates internal functions to use comparison utilities, replaces substr() with substring()
src/vs/base/test/common/glob.test.ts Adds test coverage for case-insensitive glob matching with various patterns

@dmitrivMS dmitrivMS added the file-glob File glob engine label Oct 28, 2025
@dmitrivMS
Copy link
Contributor Author

FYI - second PR dependent on this (in draft):
#273860

@dmitrivMS dmitrivMS added the search Search widget and operation issues label Oct 29, 2025
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overall a well engineered PR as far as I can tell. Only 1 comment about how we could simplify the match method. See below.

@dmitrivMS dmitrivMS requested a review from bpasero October 29, 2025 17:28
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitrivMS can we do a follow up PR then to adopt a few places where we seem to be doing some toLowercase magic to get case insensitive matching today:

@dmitrivMS
Copy link
Contributor Author

@bpasero Yep, absolutely, I had the same idea and started on it, but wanted to have it as a separate PR.
My second PR builds on this one without touching UI or changing behavior, so it would be a good place to make these changes as well since they don't change behavior either.

@dmitrivMS dmitrivMS merged commit 80be1e2 into main Oct 29, 2025
27 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/glob-1 branch October 29, 2025 21:21
dmitrivMS added a commit that referenced this pull request Oct 29, 2025
* Support case-insensitive glob

* PR feedback

* PR feedback
@dmitrivMS
Copy link
Contributor Author

Follow up PR: #273837

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

file-glob File glob engine search Search widget and operation issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glob matching should be case insensitive

3 participants