mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-09 21:28:43 +08:00
Migrate escapeForRegExp to string-utilities
R=szuend@chromium.org Bug: 1050549 Change-Id: I5cd76d53567108ac972bfc9bf002694c2219e00a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2631117 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
10e970269b
commit
bafa3bd3e7
@@ -7,6 +7,7 @@
|
||||
import * as Common from '../common/common.js';
|
||||
import * as i18n from '../i18n/i18n.js';
|
||||
import * as Persistence from '../persistence/persistence.js';
|
||||
import * as Platform from '../platform/platform.js';
|
||||
import * as SDK from '../sdk/sdk.js';
|
||||
import * as TextUtils from '../text_utils/text_utils.js'; // eslint-disable-line no-unused-vars
|
||||
import * as UI from '../ui/ui.js';
|
||||
@@ -110,7 +111,7 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
|
||||
}
|
||||
|
||||
async searchInPath(query: string, _progress: Common.Progress.Progress): Promise<string[]> {
|
||||
const re = new RegExp(query.escapeForRegExp(), 'i');
|
||||
const re = new RegExp(Platform.StringUtilities.escapeForRegExp(query), 'i');
|
||||
const allSnippets: Snippet[] = this._snippetsSetting.get();
|
||||
const matchedSnippets = allSnippets.filter(snippet => snippet.content.match(re));
|
||||
return matchedSnippets.map(snippet => `snippet:///${escapeSnippetName(snippet.name)}`);
|
||||
|
||||
Reference in New Issue
Block a user