refactor: use regex over fancy-regex in pattern-items implementation

This commit is contained in:
dinocosta 2025-07-23 10:04:25 +01:00
parent 0ab17c95fb
commit aa07594057
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View file

@ -14568,12 +14568,12 @@ dependencies = [
"client", "client",
"collections", "collections",
"editor", "editor",
"fancy-regex 0.14.0",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"language", "language",
"menu", "menu",
"project", "project",
"regex",
"schemars", "schemars",
"serde", "serde",
"serde_json", "serde_json",

View file

@ -42,7 +42,7 @@ util.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true zed_actions.workspace = true
workspace-hack.workspace = true workspace-hack.workspace = true
fancy-regex.workspace = true regex.workspace = true
[dev-dependencies] [dev-dependencies]
client = { workspace = true, features = ["test-support"] } client = { workspace = true, features = ["test-support"] }

View file

@ -13,7 +13,6 @@ use editor::{
DisplayPoint, Editor, EditorSettings, DisplayPoint, Editor, EditorSettings,
actions::{Backtab, Tab}, actions::{Backtab, Tab},
}; };
use fancy_regex::Regex;
use futures::channel::oneshot; use futures::channel::oneshot;
use gpui::{ use gpui::{
Action, App, ClickEvent, Context, Entity, EventEmitter, Focusable, InteractiveElement as _, Action, App, ClickEvent, Context, Entity, EventEmitter, Focusable, InteractiveElement as _,
@ -25,6 +24,7 @@ use project::{
search::SearchQuery, search::SearchQuery,
search_history::{SearchHistory, SearchHistoryCursor}, search_history::{SearchHistory, SearchHistoryCursor},
}; };
use regex::Regex;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
use settings::Settings; use settings::Settings;
@ -657,7 +657,7 @@ impl BufferSearchBar {
let pattern_items_regex = Regex::new( let pattern_items_regex = Regex::new(
&PATTERN_ITEMS &PATTERN_ITEMS
.iter() .iter()
.map(|(pattern, _, _)| fancy_regex::escape(pattern)) .map(|(pattern, _, _)| regex::escape(pattern))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join("|"), .join("|"),
) )