diff options
Diffstat (limited to 'crates/ra_analysis/src/hir/module/nameres.rs')
-rw-r--r-- | crates/ra_analysis/src/hir/module/nameres.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index 9dc54f6c0..f22832eda 100644 --- a/crates/ra_analysis/src/hir/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs | |||
@@ -30,7 +30,7 @@ use crate::{ | |||
30 | Cancelable, FileId, | 30 | Cancelable, FileId, |
31 | loc2id::{DefId, DefLoc}, | 31 | loc2id::{DefId, DefLoc}, |
32 | hir::{ | 32 | hir::{ |
33 | SourceFileItemId, SourceFileItems, | 33 | SourceItemId, SourceFileItemId, SourceFileItems, |
34 | Path, PathKind, | 34 | Path, PathKind, |
35 | HirDatabase, | 35 | HirDatabase, |
36 | module::{ModuleId, ModuleTree}, | 36 | module::{ModuleId, ModuleTree}, |
@@ -99,7 +99,11 @@ pub(crate) struct NamedImport { | |||
99 | 99 | ||
100 | impl NamedImport { | 100 | impl NamedImport { |
101 | pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange { | 101 | pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange { |
102 | let syntax = db.file_item(file_id, self.file_item_id); | 102 | let source_item_id = SourceItemId { |
103 | file_id, | ||
104 | item_id: self.file_item_id, | ||
105 | }; | ||
106 | let syntax = db.file_item(source_item_id); | ||
103 | let offset = syntax.borrowed().range().start(); | 107 | let offset = syntax.borrowed().range().start(); |
104 | self.relative_range + offset | 108 | self.relative_range + offset |
105 | } | 109 | } |
@@ -247,8 +251,10 @@ where | |||
247 | continue; | 251 | continue; |
248 | } | 252 | } |
249 | let def_loc = DefLoc::Item { | 253 | let def_loc = DefLoc::Item { |
250 | file_id, | 254 | source_item_id: SourceItemId { |
251 | id: item.id, | 255 | file_id, |
256 | item_id: item.id, | ||
257 | }, | ||
252 | }; | 258 | }; |
253 | let def_id = self.db.id_maps().def_id(def_loc); | 259 | let def_id = self.db.id_maps().def_id(def_loc); |
254 | let resolution = Resolution { | 260 | let resolution = Resolution { |