diff options
Diffstat (limited to 'crates/vfs/src/file_set.rs')
-rw-r--r-- | crates/vfs/src/file_set.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index 8bce17bc0..0caddc3bc 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs | |||
@@ -20,15 +20,24 @@ impl FileSet { | |||
20 | self.files.len() | 20 | self.files.len() |
21 | } | 21 | } |
22 | pub fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { | 22 | pub fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { |
23 | let mut base = self.paths[&anchor].clone(); | 23 | let mut base = dbg!(self.paths[&anchor].clone()); |
24 | base.pop(); | 24 | base.pop(); |
25 | let path = base.join(path)?; | 25 | let path = dbg!(base).join(dbg!(path))?; |
26 | self.files.get(&path).copied() | 26 | self.files.get(&path).copied() |
27 | } | 27 | } |
28 | pub fn list_some_random_files_todo(&self, anchor: FileId) -> Vec<(FileId, String)> { | 28 | |
29 | let anchor_path = self.paths[&anchor].clone(); | 29 | pub fn file_name_and_extension(&self, file: FileId) -> Option<(&str, &str)> { |
30 | self.paths[&file].file_name_and_extension() | ||
31 | } | ||
32 | |||
33 | pub fn list_files(&self, directory: FileId) -> Vec<(FileId, String)> { | ||
34 | // TODO kb determine the ways to list all applicable files | ||
35 | // Maybe leave list directory here only and the move the rest of the logic into the database impl? | ||
36 | // cache results in Salsa? | ||
37 | |||
38 | dbg!(directory); | ||
30 | /* | 39 | /* |
31 | [crates/vfs/src/file_set.rs:30] anchor_path = "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/lib.rs" | 40 | [crates/vfs/src/file_set.rs:30] directory = "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/" |
32 | [crates/vfs/src/file_set.rs:31] self.files.keys() = [ | 41 | [crates/vfs/src/file_set.rs:31] self.files.keys() = [ |
33 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2/test_mod_3.rs", | 42 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2/test_mod_3.rs", |
34 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2.rs", | 43 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2.rs", |
@@ -38,15 +47,6 @@ impl FileSet { | |||
38 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3.rs", | 47 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3.rs", |
39 | ] | 48 | ] |
40 | */ | 49 | */ |
41 | |||
42 | // TODO kb determine the ways to list all applicable files | ||
43 | // Maybe leave list directory here only and the move the rest of the logic into the database impl? | ||
44 | |||
45 | // Need to get the following things: | ||
46 | // * name of the anchor_path file (file_name, validate that it's a file!) | ||
47 | // * list of all files in the file's contai/ning directory (file_dir) | ||
48 | // * list of all files in `file_dir/file_name` or just `file_dir/`, for lib.rs or mod.rs | ||
49 | // * consider special case for /src/bin/foo.rs as a mod<|> source | ||
50 | Vec::new() | 50 | Vec::new() |
51 | } | 51 | } |
52 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { | 52 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { |