aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorEkaterina Babshukova <[email protected]>2019-09-16 11:48:54 +0100
committerEkaterina Babshukova <[email protected]>2019-09-19 17:38:27 +0100
commit2867c40925e8f7b440ff50a421a2d3726b9ff334 (patch)
tree95a8f33d0c334debf5eec41c2edf6fb01a5dcb49 /crates/ra_ide_api/src/completion
parentc35ef7e1ed97172ab644248185b75dceebb0d35a (diff)
introduce FromSource trait
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs7
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 @@
1use hir::source_binder;
2use ra_syntax::{ 1use 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 =