From 4bed588001a1d6cd5c83a3eefc6ef77c439de40b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 28 Aug 2020 21:28:30 +0300 Subject: First steps for mod<|> completion --- crates/vfs/src/file_set.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'crates/vfs') diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index e9196fcd2..8bce17bc0 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs @@ -23,8 +23,31 @@ impl FileSet { let mut base = self.paths[&anchor].clone(); base.pop(); let path = base.join(path)?; - let res = self.files.get(&path).copied(); - res + self.files.get(&path).copied() + } + pub fn list_some_random_files_todo(&self, anchor: FileId) -> Vec<(FileId, String)> { + let anchor_path = self.paths[&anchor].clone(); + /* + [crates/vfs/src/file_set.rs:30] anchor_path = "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/lib.rs" + [crates/vfs/src/file_set.rs:31] self.files.keys() = [ + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2/test_mod_3.rs", + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2.rs", + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1.rs", + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/lib.rs", + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3/test_mod_3_1.rs", + "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3.rs", + ] + */ + + // TODO kb determine the ways to list all applicable files + // Maybe leave list directory here only and the move the rest of the logic into the database impl? + + // Need to get the following things: + // * name of the anchor_path file (file_name, validate that it's a file!) + // * list of all files in the file's contai/ning directory (file_dir) + // * list of all files in `file_dir/file_name` or just `file_dir/`, for lib.rs or mod.rs + // * consider special case for /src/bin/foo.rs as a mod<|> source + Vec::new() } pub fn insert(&mut self, file_id: FileId, path: VfsPath) { self.files.insert(path.clone(), file_id); -- cgit v1.2.3