diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_context.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index 7139947b3..59bd3689b 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | use hir::source_binder; | ||
2 | use ra_syntax::{ | 1 | use ra_syntax::{ |
3 | algo::{find_covering_element, find_node_at_offset}, | 2 | algo::{find_covering_element, find_node_at_offset}, |
4 | ast, AstNode, Parse, SourceFile, | 3 | ast, AstNode, Parse, SourceFile, |
@@ -47,7 +46,11 @@ impl<'a> CompletionContext<'a> { | |||
47 | original_parse: &'a Parse<ast::SourceFile>, | 46 | original_parse: &'a Parse<ast::SourceFile>, |
48 | position: FilePosition, | 47 | position: FilePosition, |
49 | ) -> Option<CompletionContext<'a>> { | 48 | ) -> Option<CompletionContext<'a>> { |
50 | let module = source_binder::module_from_position(db, position); | 49 | let src = hir::ModuleSource::from_position(db, position); |
50 | let module = hir::Module::from_definition( | ||
51 | db, | ||
52 | hir::Source { file_id: position.file_id.into(), ast: src }, | ||
53 | ); | ||
51 | let token = | 54 | let token = |
52 | original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?; | 55 | original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?; |
53 | let analyzer = | 56 | let analyzer = |