Replace remaining usages of glob crate with globset
This commit is contained in:
parent
459cc9c959
commit
847d1e73a3
7 changed files with 8 additions and 14 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue