Support absolute disabled_globs (#25755)

Closes: #25556

We were always comparing `disabled_globs` against the relative file
path, we'll now use the absolute path if the glob is also absolute.

Release Notes:

- Support absolute globs in `edit_predictions.disabled_globs`
This commit is contained in:
Agus Zubiaga 2025-02-27 15:29:32 -03:00 committed by GitHub
parent c5632f8c31
commit 6eb2ffe77a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 191 additions and 16 deletions

View file

@ -4477,6 +4477,7 @@ impl IndentSize {
pub struct TestFile {
pub path: Arc<Path>,
pub root_name: String,
pub local_root: Option<PathBuf>,
}
#[cfg(any(test, feature = "test-support"))]
@ -4490,7 +4491,11 @@ impl File for TestFile {
}
fn as_local(&self) -> Option<&dyn LocalFile> {
None
if self.local_root.is_some() {
Some(self)
} else {
None
}
}
fn disk_state(&self) -> DiskState {
@ -4518,6 +4523,23 @@ impl File for TestFile {
}
}
#[cfg(any(test, feature = "test-support"))]
impl LocalFile for TestFile {
fn abs_path(&self, _cx: &App) -> PathBuf {
PathBuf::from(self.local_root.as_ref().unwrap())
.join(&self.root_name)
.join(self.path.as_ref())
}
fn load(&self, _cx: &App) -> Task<Result<String>> {
unimplemented!()
}
fn load_bytes(&self, _cx: &App) -> Task<Result<Vec<u8>>> {
unimplemented!()
}
}
pub(crate) fn contiguous_ranges(
values: impl Iterator<Item = u32>,
max_len: usize,