diff options
author | Kirill Bulatov <[email protected]> | 2020-08-28 19:28:30 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-09-09 23:42:20 +0100 |
commit | 4bed588001a1d6cd5c83a3eefc6ef77c439de40b (patch) | |
tree | 92552f2af9a6aefcd4fffc20d7cbd06d1bc74d3c /crates/vfs/src | |
parent | 5c336e266fe09ae9ae6e634513d441cbcde63696 (diff) |
First steps for mod<|> completion
Diffstat (limited to 'crates/vfs/src')
-rw-r--r-- | crates/vfs/src/file_set.rs | 27 |
1 files changed, 25 insertions, 2 deletions
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 { | |||
23 | let mut base = self.paths[&anchor].clone(); | 23 | let mut base = self.paths[&anchor].clone(); |
24 | base.pop(); | 24 | base.pop(); |
25 | let path = base.join(path)?; | 25 | let path = base.join(path)?; |
26 | let res = self.files.get(&path).copied(); | 26 | self.files.get(&path).copied() |
27 | res | 27 | } |
28 | pub fn list_some_random_files_todo(&self, anchor: FileId) -> Vec<(FileId, String)> { | ||
29 | let anchor_path = self.paths[&anchor].clone(); | ||
30 | /* | ||
31 | [crates/vfs/src/file_set.rs:30] anchor_path = "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/lib.rs" | ||
32 | [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", | ||
34 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1/test_mod_2.rs", | ||
35 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_1.rs", | ||
36 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/lib.rs", | ||
37 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3/test_mod_3_1.rs", | ||
38 | "/Users/someonetoignore/Downloads/tmp_dir/zzzz/src/test_mod_3.rs", | ||
39 | ] | ||
40 | */ | ||
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() | ||
28 | } | 51 | } |
29 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { | 52 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { |
30 | self.files.insert(path.clone(), file_id); | 53 | self.files.insert(path.clone(), file_id); |