First steps for mod<|> completion

This commit is contained in:
Kirill Bulatov 2020-08-28 21:28:30 +03:00
parent 5c336e266f
commit 4bed588001
4 changed files with 65 additions and 6 deletions

View file

@ -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);