diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts index 885e29f3321ad8789298605ca4c6fda3aad48a86..387525b12d94b6d96deb14ce4b30634bf5ce1f98 100644 --- a/src/vs/platform/search/common/search.ts +++ b/src/vs/platform/search/common/search.ts @@ -302,6 +302,7 @@ export class OneLineRange extends SearchRange { export interface ISearchConfigurationProperties { exclude: glob.IExpression; useRipgrep: boolean; + disableRipgrep: boolean; /** * Use ignore file for file search. */ diff --git a/src/vs/workbench/parts/search/common/queryBuilder.ts b/src/vs/workbench/parts/search/common/queryBuilder.ts index f93e64788840051ed84aa75efb2a4f9d95be9b5c..8913a8cd4ed215cf2223ec1d738bce705ea6163a 100644 --- a/src/vs/workbench/parts/search/common/queryBuilder.ts +++ b/src/vs/workbench/parts/search/common/queryBuilder.ts @@ -70,6 +70,11 @@ export class QueryBuilder { const searchConfig = this.configurationService.getValue(); contentPattern.wordSeparators = searchConfig.editor.wordSeparators; + const fallbackToPCRE = !folderResources || folderResources.some(folder => { + const folderConfig = this.configurationService.getValue({ resource: folder }); + return !folderConfig.search.useRipgrep; + }); + const commonQuery = this.commonQuery(folderResources, options); return { ...commonQuery, @@ -77,7 +82,7 @@ export class QueryBuilder { contentPattern, previewOptions: options && options.previewOptions, maxFileSize: options && options.maxFileSize, - usePCRE2: searchConfig.search.usePCRE2 + usePCRE2: searchConfig.search.usePCRE2 || fallbackToPCRE }; } @@ -111,7 +116,7 @@ export class QueryBuilder { const useRipgrep = !folderResources || folderResources.every(folder => { const folderConfig = this.configurationService.getValue({ resource: folder }); - return folderConfig.search.useRipgrep; + return !folderConfig.search.disableRipgrep; }); const queryProps: ICommonQueryProps = { diff --git a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts index 4e68c2bc01e4f7ac4cd749124ea49a24808e06a7..aa5d12053e7dbb119f6e69416936c0513c006b49 100644 --- a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts +++ b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts @@ -586,9 +586,16 @@ configurationRegistry.registerConfiguration({ }, 'search.useRipgrep': { type: 'boolean', - description: nls.localize('useRipgrep', "Controls whether to use ripgrep in text and file search."), + description: nls.localize('useRipgrep', "Deprecated. This setting now falls back on \"search.usePCRE2\"."), + deprecationMessage: nls.localize('useRipgrepDeprecated', "Deprecated. Consider \"search.usePCRE2\" for advanced regex feature support."), default: true }, + 'search.disableRipgrep': { + type: 'boolean', + description: nls.localize('disableRipgrep', "Deprecated. Controls whether to use ripgrep in text and file search."), + deprecationMessage: nls.localize('disableRipgrepDeprecated', "Deprecated. Consider \"search.usePCRE2\" for advanced regex feature support."), + default: false + }, 'search.useIgnoreFiles': { type: 'boolean', markdownDescription: nls.localize('useIgnoreFiles', "Controls whether to use `.gitignore` and `.ignore` files when searching for files."),