Move most of the logic into the completion module

This commit is contained in:
Kirill Bulatov 2020-09-07 20:52:37 +03:00
parent 6ba479cd05
commit f9c14ac720
8 changed files with 107 additions and 118 deletions

View file

@ -12,7 +12,7 @@ use cfg::CfgOptions;
use rustc_hash::{FxHashMap, FxHashSet};
use syntax::SmolStr;
use tt::TokenExpander;
use vfs::file_set::FileSet;
use vfs::{file_set::FileSet, VfsPath};
pub use vfs::FileId;
@ -43,6 +43,12 @@ impl SourceRoot {
pub fn new_library(file_set: FileSet) -> SourceRoot {
SourceRoot { is_library: true, file_set }
}
pub fn path_for_file(&self, file: &FileId) -> Option<&VfsPath> {
self.file_set.path_for_file(file)
}
pub fn file_for_path(&self, path: &VfsPath) -> Option<&FileId> {
self.file_set.file_for_path(path)
}
pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ {
self.file_set.iter()
}