From 047f07958d8883f45c646a52599e315212bb1282 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 29 Oct 2018 14:58:48 -0700 Subject: [PATCH] Add notification to searchview for search.usePCRE2 --- src/vs/workbench/parts/search/browser/searchView.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index 4425bcfde59..8aea3f5a394 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -1245,12 +1245,19 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { this.searchWidget.searchInput.showMessage({ content: e.message, type: MessageType.ERROR }); this.viewModel.searchResult.clear(); - if (e.code === SearchErrorCode.unknownEncoding) { + if (e.code === SearchErrorCode.unknownEncoding && !this.configurationService.getValue('search.useLegacySearch')) { this.notificationService.prompt(Severity.Info, nls.localize('otherEncodingWarning', "You can enable \"search.useLegacySearch\" to search non-standard file encodings."), [{ label: nls.localize('otherEncodingWarning.openSettingsLabel', "Open Settings"), run: () => this.openSettings('search.useLegacySearch') }]); + } else if (e.code === SearchErrorCode.regexParseError && !this.configurationService.getValue('search.usePCRE2')) { + // If the regex parsed in JS but not rg, it likely uses features that are supported in JS and PCRE2 but not Rust + this.notificationService.prompt(Severity.Info, nls.localize('rgRegexError', "You can enable \"search.usePCRE2\" to enable some extra regex features like lookbehind and backreferences."), + [{ + label: nls.localize('otherEncodingWarning.openSettingsLabel', "Open Settings"), + run: () => this.openSettings('search.usePCRE2') + }]); } } }; -- GitLab