mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Resolve 2015 style imports
This commit is contained in:
parent
3a9934e2c3
commit
d5ad38cbb8
4 changed files with 119 additions and 9 deletions
|
@ -119,6 +119,10 @@ impl CrateGraph {
|
|||
self.arena[&crate_id].file_id
|
||||
}
|
||||
|
||||
pub fn edition(&self, crate_id: CrateId) -> Edition {
|
||||
self.arena[&crate_id].edition
|
||||
}
|
||||
|
||||
// TODO: this only finds one crate with the given root; we could have multiple
|
||||
pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId> {
|
||||
let (&crate_id, _) = self.arena.iter().find(|(_crate_id, data)| data.file_id == file_id)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue