diff options
author | Aleksey Kladov <[email protected]> | 2019-04-10 09:15:55 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-11 14:29:33 +0100 |
commit | 10d66d63d716a10ba7a5a8d1b69c9066249caf69 (patch) | |
tree | 3897deea123f2bec49c28cdeb453ae0cfa0f49f1 /crates/ra_ide_api/src/completion/completion_context.rs | |
parent | e6e2571bdf780d304c792d4317bbaf1d6f5d7a0a (diff) |
introduce SourceAnalyzer
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_context.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index 65dffa470..ce21fca9b 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs | |||
@@ -14,6 +14,7 @@ use crate::{db, FilePosition}; | |||
14 | #[derive(Debug)] | 14 | #[derive(Debug)] |
15 | pub(crate) struct CompletionContext<'a> { | 15 | pub(crate) struct CompletionContext<'a> { |
16 | pub(super) db: &'a db::RootDatabase, | 16 | pub(super) db: &'a db::RootDatabase, |
17 | pub(super) analyzer: hir::SourceAnalyser, | ||
17 | pub(super) offset: TextUnit, | 18 | pub(super) offset: TextUnit, |
18 | pub(super) token: SyntaxToken<'a>, | 19 | pub(super) token: SyntaxToken<'a>, |
19 | pub(super) resolver: Resolver, | 20 | pub(super) resolver: Resolver, |
@@ -50,8 +51,10 @@ impl<'a> CompletionContext<'a> { | |||
50 | let resolver = source_binder::resolver_for_position(db, position); | 51 | let resolver = source_binder::resolver_for_position(db, position); |
51 | let module = source_binder::module_from_position(db, position); | 52 | let module = source_binder::module_from_position(db, position); |
52 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; | 53 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; |
54 | let analyzer = hir::SourceAnalyser::new(db, position.file_id, token.parent()); | ||
53 | let mut ctx = CompletionContext { | 55 | let mut ctx = CompletionContext { |
54 | db, | 56 | db, |
57 | analyzer, | ||
55 | token, | 58 | token, |
56 | offset: position.offset, | 59 | offset: position.offset, |
57 | resolver, | 60 | resolver, |