From 2867c40925e8f7b440ff50a421a2d3726b9ff334 Mon Sep 17 00:00:00 2001 From: Ekaterina Babshukova Date: Mon, 16 Sep 2019 13:48:54 +0300 Subject: introduce FromSource trait --- crates/ra_ide_api/src/completion/completion_context.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src/completion') 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 @@ -use hir::source_binder; use ra_syntax::{ algo::{find_covering_element, find_node_at_offset}, ast, AstNode, Parse, SourceFile, @@ -47,7 +46,11 @@ impl<'a> CompletionContext<'a> { original_parse: &'a Parse, position: FilePosition, ) -> Option> { - let module = source_binder::module_from_position(db, position); + let src = hir::ModuleSource::from_position(db, position); + let module = hir::Module::from_definition( + db, + hir::Source { file_id: position.file_id.into(), ast: src }, + ); let token = original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?; let analyzer = -- cgit v1.2.3