diff options
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 48d69f7e5..deaacda6c 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -52,15 +52,11 @@ impl<'a> CompletionContext<'a> { | |||
52 | original_parse: &'a Parse<ast::SourceFile>, | 52 | original_parse: &'a Parse<ast::SourceFile>, |
53 | position: FilePosition, | 53 | position: FilePosition, |
54 | ) -> Option<CompletionContext<'a>> { | 54 | ) -> Option<CompletionContext<'a>> { |
55 | let src = hir::ModuleSource::from_position(db, position); | 55 | let mut sb = hir::SourceBinder::new(db); |
56 | let module = hir::Module::from_definition( | 56 | let module = sb.to_module_def(position.file_id); |
57 | db, | ||
58 | hir::InFile { file_id: position.file_id.into(), value: src }, | ||
59 | ); | ||
60 | let token = | 57 | let token = |
61 | original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?; | 58 | original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?; |
62 | let analyzer = hir::SourceAnalyzer::new( | 59 | let analyzer = sb.analyze( |
63 | db, | ||
64 | hir::InFile::new(position.file_id.into(), &token.parent()), | 60 | hir::InFile::new(position.file_id.into(), &token.parent()), |
65 | Some(position.offset), | 61 | Some(position.offset), |
66 | ); | 62 | ); |