-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Support case-insensitive ripgrep and file search #273860
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 support for case-insensitive glob pattern matching in the search functionality. The main changes include:
- Adding
ignoreGlobPatternCaseproperty to query interfaces and type definitions - Passing
ignoreCaseoptions to glob parsing and matching functions - Using case-insensitive string comparisons where appropriate
- Fixing several spelling errors in comments (e.g., "sibilings" → "siblings", "shoudn't" → "shouldn't", "naieve" → "naive", "Preservering" → "Preserving", "expectred" → "expected", "ouside" → "outside")
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/search/worker/localFileSearch.ts | Adds ignoreGlobPatternCase to glob options, passes to IgnoreFile, and fixes "siblings" typo |
| src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts | Passes ignoreGlobPatternCase to ripgrep options and adds glob-case-insensitive flags |
| src/vs/workbench/services/search/node/ripgrepSearchProvider.ts | Combines ignoreGlobPatternCase from multiple sources |
| src/vs/workbench/services/search/node/ripgrepFileSearch.ts | Adds case-insensitive glob flags for ripgrep |
| src/vs/workbench/services/search/node/fileSearch.ts | Uses strings.equals for case-insensitive file pattern matching |
| src/vs/workbench/services/search/common/textSearchManager.ts | Fixes "shouldn't" typo and passes ignoreGlobPatternCase to options |
| src/vs/workbench/services/search/common/searchExtTypes.ts | Adds ignoreGlobPatternCase documentation to interfaces |
| src/vs/workbench/services/search/common/search.ts | Adds ignoreGlobPatternCase to query interfaces and uses in path matching |
| src/vs/workbench/services/search/common/queryBuilder.ts | Adds ignoreGlobPatternCase to query builder options |
| src/vs/workbench/services/search/common/ignoreFile.ts | Adds ignoreCase parameter and fixes multiple spelling errors |
| src/vs/workbench/services/search/common/fileSearchManager.ts | Uses strings.equals for case-insensitive comparisons |
Rename `ChatService.getHistory` to `getLocalSessionHistory`
Consolidate duplicated UpdateTracker code in promptsServiceImpl.ts
…aquamarine Update merge and diff-multiple icons in codicons
Noticed this when working on edit sessions, this seems like what the intended behavior should be
…rsor (#273833) * Initial plan * Fix cursor navigation in wrapped lines Change cursor position check to only enable history navigation when cursor is at line 1, column 1. This prevents accidental history navigation when pressing up arrow on wrapped lines. Co-authored-by: alexdima <5047891+alexdima@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexdima <5047891+alexdima@users.noreply.github.com>
…am-tan titlebar: reduce Command Center spacer icon horizontal padding to 8px
| searchService: ISearchService | ||
| ): Promise<{ folders: URI[]; files: URI[] }> { | ||
| const segmentMatchPattern = caseInsensitiveGlobPattern(fuzzyMatch ? fuzzyMatchingGlobPattern(pattern) : continousMatchingGlobPattern(pattern)); | ||
| const segmentMatchPattern = fuzzyMatch ? fuzzyMatchingGlobPattern(pattern) : continuousMatchingGlobPattern(pattern); |
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.
caseInsensitiveGlobPattern() was used to make case-insensitive glob matching. Removed this method and passing { ignoreCase: true } to the glob.match() call below instead.
| cacheKey, | ||
| excludePattern: searchExcludePattern, | ||
| sortByScore: true, | ||
| ignoreGlobPatternCase: true |
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.
Based on glob case-insensitivity, assuming that we want case-insensitive search here, so passing ignoreGlobPatternCase: true to the search service.
| private async searchInWorkspace(patternLowercase: string, root: ExplorerItem, rootIndex: number, isFuzzyMatch: boolean, token: CancellationToken): Promise<{ explorerRoot: ExplorerItem; files: URI[]; directories: URI[]; hitMaxResults: boolean }> { | ||
| const segmentMatchPattern = caseInsensitiveGlobPattern(isFuzzyMatch ? fuzzyMatchingGlobPattern(patternLowercase) : continousMatchingGlobPattern(patternLowercase)); | ||
| private async searchInWorkspace(pattern: string, root: ExplorerItem, rootIndex: number, isFuzzyMatch: boolean, token: CancellationToken): Promise<{ explorerRoot: ExplorerItem; files: URI[]; directories: URI[]; hitMaxResults: boolean }> { | ||
| const segmentMatchPattern = isFuzzyMatch ? fuzzyMatchingGlobPattern(pattern) : continuousMatchingGlobPattern(pattern); |
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.
caseInsensitiveGlobPattern() was used to make case-insensitive glob matching. Removed this method and passing { ignoreCase: true } to the glob.match() call below instead.
| shouldGlobMatchFilePattern: true, | ||
| cacheKey: `explorerfindprovider:${root.name}:${rootIndex}:${this.sessionId}`, | ||
| excludePattern: searchExcludePattern, | ||
| ignoreGlobPatternCase: true |
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.
Based on glob case-insensitivity, assuming that we want case-insensitive search here, so passing ignoreGlobPatternCase: true to the search service.
| const uri = URI.file(path); | ||
| if (extUri.isEqualOrParent(uri, searchPath)) { | ||
| const folderGlobOptions = { ignoreCase: queryProps.ignoreGlobPatternCase || fq.ignoreGlobPatternCase }; | ||
| if (extUri.isEqualOrParent(uri, searchPath, folderGlobOptions.ignoreCase)) { |
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.
added ignoreCase argument to isEqualOrParent() call because it is related to glob matching.
| else { | ||
| this.filesWalked++; | ||
| if (currentRelativePath === this.filePattern) { | ||
| if (strings.equals(currentRelativePath, this.filePattern, ignoreCase)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| // are searching for and we want to include the result in that case anyway | ||
| const currentRelativePath = relativeParentPath ? [relativeParentPath, file].join(path.sep) : file; | ||
| if (this.folderExcludePatterns.get(folderQuery.folder.fsPath)!.test(currentRelativePath, file, this.config.filePattern !== file ? hasSibling : undefined)) { | ||
| if (this.folderExcludePatterns.get(folderQuery.folder.fsPath)!.test(currentRelativePath, file, !strings.equals(this.config.filePattern, file, ignoreCase) ? hasSibling : undefined)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| } else { | ||
| self.filesWalked++; | ||
| if (relativePath === filePattern) { | ||
| if (strings.equals(relativePath, filePattern, ignoreCase)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| // to ignore filtering by siblings because the user seems to know what they | ||
| // are searching for and we want to include the result in that case anyway | ||
| if (excludePattern.test(relativePath, basename, filePattern !== basename ? hasSibling : undefined)) { | ||
| if (excludePattern.test(relativePath, basename, !strings.equals(filePattern, basename, ignoreCase) ? hasSibling : undefined)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| return !!queryProps.folderQueries && queryProps.folderQueries.some(fq => { | ||
| const searchPath = fq.folder.fsPath; | ||
| if (extpath.isEqualOrParent(fsPath, searchPath)) { | ||
| if (extpath.isEqualOrParent(fsPath, searchPath, globOptions.ignoreCase)) { |
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.
Added ignoreCase argument to isEqualOrParent() call because it is related to glob matching.
| private addDirectoryEntries({ pathToEntries }: IDirectoryTree, base: URI, relativeFile: string, onResult: (result: IInternalFileMatch) => void) { | ||
| // Support relative paths to files from a root resource (ignores excludes) | ||
| if (relativeFile === this.filePattern) { | ||
| if (this.filePattern !== undefined && strings.equals(relativeFile, this.filePattern, this.config.ignoreGlobPatternCase)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| // to ignore filtering by siblings because the user seems to know what they | ||
| // are searching for and we want to include the result in that case anyway | ||
| if (queryTester.matchesExcludesSync(relativePath, basename, filePattern !== basename ? hasSibling : undefined)) { | ||
| if (queryTester.matchesExcludesSync(relativePath, basename, !strings.equals(filePattern, basename, ignoreCase) ? hasSibling : undefined)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
| matchDirectory(sub); | ||
| } else { | ||
| if (relativePath === filePattern) { | ||
| if (strings.equals(relativePath, filePattern, ignoreCase)) { |
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.
Added ignoreCase argument to string comparison because it is related to glob matching.
|
Closing, will open a new one in its place. |
Second step towards fixing #10633 and many related duplicates.
This PR adds an option to enable case-insensitive ripgrep and file search, in part by using case-insensitive glob support.
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.