Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Replace remaining usages of glob crate with globset
Max Brunsfeld847d1e73a33e
diff --git a/Cargo.lock b/Cargo.lockindex 7129cc8b817..3ae96f47517 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2038,7 +2038,6 @@ dependencies = ["futures 0.3.28","fuzzy","git",- "glob","gpui","indoc","itertools",@@ -3442,7 +3441,7 @@ dependencies = ["futures 0.3.28","fuzzy","git",- "glob",+ "globset","gpui","indoc","lazy_static",@@ -6111,7 +6110,6 @@ dependencies = ["collections","fs","futures 0.3.28",- "glob","gpui","json_comments","lazy_static",diff --git a/Cargo.toml b/Cargo.tomlindex c31624b5fe2..4854be0c7bb 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -78,7 +78,6 @@ ctor = { version = "0.1" }env_logger = { version = "0.9" }futures = { version = "0.3" }globset = { version = "0.4" }-glob = { version = "0.3.1" }lazy_static = { version = "1.4.0" }log = { version = "0.4.16", features = ["kv_unstable_serde"] }ordered-float = { version = "2.1.1" }diff --git a/crates/copilot_button/src/copilot_button.rs b/crates/copilot_button/src/copilot_button.rsindex 73cd8f6a1d8..fdd0da19700 100644--- a/crates/copilot_button/src/copilot_button.rs+++ b/crates/copilot_button/src/copilot_button.rs@@ -335,10 +335,9 @@ async fn configure_disabled_globs(.get::<AllLanguageSettings>(None).copilot.disabled_globs- .clone().iter()- .map(|glob| glob.as_str().to_string())- .collect::<Vec<_>>()+ .map(|glob| glob.glob().to_string())+ .collect()});if let Some(path_to_disable) = &path_to_disable {diff --git a/crates/editor/Cargo.toml b/crates/editor/Cargo.tomlindex fc7bf4b8aba..325883b7c03 100644--- a/crates/editor/Cargo.toml+++ b/crates/editor/Cargo.toml@@ -49,7 +49,6 @@ workspace = { path = "../workspace" }aho-corasick = "0.7"anyhow.workspace = truefutures.workspace = true-glob.workspace = trueindoc = "1.0.4"itertools = "0.10"lazy_static.workspace = true@@ -82,7 +81,6 @@ workspace = { path = "../workspace", features = ["test-support"] }ctor.workspace = trueenv_logger.workspace = true-glob.workspace = truerand.workspace = trueunindent.workspace = truetree-sitter = "0.20"diff --git a/crates/language/Cargo.toml b/crates/language/Cargo.tomlindex 5a7644d98e6..7e81620e5ce 100644--- a/crates/language/Cargo.toml+++ b/crates/language/Cargo.toml@@ -41,7 +41,7 @@ anyhow.workspace = trueasync-broadcast = "0.4"async-trait.workspace = truefutures.workspace = true-glob.workspace = true+globset.workspace = truelazy_static.workspace = truelog.workspace = trueparking_lot.workspace = truediff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rsindex b47982819a5..d877304f1d9 100644--- a/crates/language/src/language_settings.rs+++ b/crates/language/src/language_settings.rs@@ -1,5 +1,6 @@use anyhow::Result;use collections::HashMap;+use globset::GlobMatcher;use gpui::AppContext;use schemars::{schema::{InstanceType, ObjectValidation, Schema, SchemaObject},@@ -45,7 +46,7 @@ pub struct LanguageSettings {#[derive(Clone, Debug, Default)]pub struct CopilotSettings {pub feature_enabled: bool,- pub disabled_globs: Vec<glob::Pattern>,+ pub disabled_globs: Vec<GlobMatcher>,}#[derive(Clone, Serialize, Deserialize, JsonSchema)]@@ -151,7 +152,7 @@ impl AllLanguageSettings {.copilot.disabled_globs.iter()- .any(|glob| glob.matches_path(path))+ .any(|glob| glob.is_match(path))}pub fn copilot_enabled(&self, language_name: Option<&str>, path: Option<&Path>) -> bool {@@ -236,7 +237,7 @@ impl settings::Setting for AllLanguageSettings {feature_enabled: copilot_enabled,disabled_globs: copilot_globs.iter()- .filter_map(|pattern| glob::Pattern::new(pattern).ok())+ .filter_map(|g| Some(globset::Glob::new(g).ok()?.compile_matcher())).collect(),},defaults,diff --git a/crates/settings/Cargo.toml b/crates/settings/Cargo.tomlindex 2cb6637eadc..1ec0ff4a635 100644--- a/crates/settings/Cargo.toml+++ b/crates/settings/Cargo.toml@@ -22,7 +22,6 @@ util = { path = "../util" }anyhow.workspace = truefutures.workspace = true-glob.workspace = truejson_comments = "0.2"lazy_static.workspace = truepostage.workspace = true