Allow opening buffers without a project entry

This commit is contained in:
Kirill Bulatov 2023-12-04 12:56:02 +02:00
parent ae6ddceb67
commit 1f6c69c7dc
8 changed files with 228 additions and 90 deletions

View file

@ -218,10 +218,13 @@ impl PathMatcher {
})
}
// TODO kb tests
pub fn is_match<P: AsRef<Path>>(&self, other: P) -> bool {
other.as_ref().starts_with(&self.maybe_path)
|| self.glob.is_match(&other)
|| self.check_with_end_separator(other.as_ref())
let other_path = other.as_ref();
other_path.starts_with(&self.maybe_path)
|| other_path.file_name() == Some(self.maybe_path.as_os_str())
|| self.glob.is_match(other_path)
|| self.check_with_end_separator(other_path)
}
fn check_with_end_separator(&self, path: &Path) -> bool {