diff options
author | Aleksey Kladov <[email protected]> | 2020-01-16 16:33:07 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-01-16 16:33:07 +0000 |
commit | 595b06a1b8fcd215c828d65ee1dd1a30c2697de9 (patch) | |
tree | f8c33cb55704c2023a5f999ebb46fda0ba4c48ab /crates/ra_ide/src/completion/completion_context.rs | |
parent | 9a6c26e34806a05260170029ace4b64adf484a23 (diff) |
Create modules via SourceBinder
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 | ); |