Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/vfs/src/file_set.rs')
| -rw-r--r-- | crates/vfs/src/file_set.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index 0c41ede5b5..c25cda2d36 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs @@ -128,6 +128,14 @@ impl FileSetConfig { self.map.stream().into_byte_vec() } + /// Returns the index of the set `path` would be partitioned into, or `None` if it + /// belongs to none of the configured sets (that is, the catch-all set for everything + /// else). + pub fn classify_path(&self, path: &VfsPath) -> Option<usize> { + let idx = self.classify(path, &mut Vec::new()); + (idx != self.len() - 1).then_some(idx) + } + /// Returns the set index for the given `path`. /// /// `scratch_space` is used as a buffer and will be entirely replaced. |