mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Encode edition within FileId in the hir layer
This commit is contained in:
parent
92268627a8
commit
5264f86242
160 changed files with 1117 additions and 824 deletions
|
@ -1,7 +1,7 @@
|
|||
use hir::{db::DefDatabase, Semantics};
|
||||
use ide_db::{
|
||||
base_db::{CrateId, FileId, FileLoader, FilePosition},
|
||||
RootDatabase,
|
||||
base_db::{CrateId, FileLoader},
|
||||
FileId, FilePosition, RootDatabase,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use syntax::{
|
||||
|
@ -26,7 +26,7 @@ use crate::NavigationTarget;
|
|||
/// This returns `Vec` because a module may be included from several places.
|
||||
pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<NavigationTarget> {
|
||||
let sema = Semantics::new(db);
|
||||
let source_file = sema.parse(position.file_id);
|
||||
let source_file = sema.parse_guess_edition(position.file_id);
|
||||
|
||||
let mut module = find_node_at_offset::<ast::Module>(source_file.syntax(), position.offset);
|
||||
|
||||
|
@ -66,7 +66,7 @@ pub(crate) fn crates_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ide_db::base_db::FileRange;
|
||||
use ide_db::FileRange;
|
||||
|
||||
use crate::fixture;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue