diff options
author | Aleksey Kladov <[email protected]> | 2019-04-11 14:49:35 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-11 14:49:35 +0100 |
commit | ebb0c377f0ab99a0f5e6d0c776cb9b026b62b0e4 (patch) | |
tree | 49a2c265c83ae03182cf593c52ec8a0c155ad151 /crates/ra_ide_api/src | |
parent | 3c9f2d0e372cff6490dcd30411cb6cc1f691fde7 (diff) |
remove resolver from CompletonContext
Diffstat (limited to 'crates/ra_ide_api/src')
4 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 7e47fa6bd..e9bdf5af2 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -9,7 +9,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
9 | Some(path) => path.clone(), | 9 | Some(path) => path.clone(), |
10 | _ => return, | 10 | _ => return, |
11 | }; | 11 | }; |
12 | let def = match ctx.resolver.resolve_path(ctx.db, &path).take_types() { | 12 | let def = match ctx.analyzer.resolver().resolve_path(ctx.db, &path).take_types() { |
13 | Some(Resolution::Def(def)) => def, | 13 | Some(Resolution::Def(def)) => def, |
14 | _ => return, | 14 | _ => return, |
15 | }; | 15 | }; |
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs index 7abcd019b..abbb83518 100644 --- a/crates/ra_ide_api/src/completion/complete_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_pattern.rs | |||
@@ -7,7 +7,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { | |||
7 | } | 7 | } |
8 | // FIXME: ideally, we should look at the type we are matching against and | 8 | // FIXME: ideally, we should look at the type we are matching against and |
9 | // suggest variants + auto-imports | 9 | // suggest variants + auto-imports |
10 | let names = ctx.resolver.all_names(ctx.db); | 10 | let names = ctx.analyzer.resolver().all_names(ctx.db); |
11 | for (name, res) in names.into_iter() { | 11 | for (name, res) in names.into_iter() { |
12 | let r = res.as_ref(); | 12 | let r = res.as_ref(); |
13 | let def = match r.take_types().or(r.take_values()) { | 13 | let def = match r.take_types().or(r.take_values()) { |
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 9d82f2270..4c5d07ce5 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -4,7 +4,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
4 | if !ctx.is_trivial_path { | 4 | if !ctx.is_trivial_path { |
5 | return; | 5 | return; |
6 | } | 6 | } |
7 | let names = ctx.resolver.all_names(ctx.db); | 7 | let names = ctx.analyzer.resolver().all_names(ctx.db); |
8 | 8 | ||
9 | names.into_iter().for_each(|(name, res)| acc.add_resolution(ctx, name.to_string(), &res)); | 9 | names.into_iter().for_each(|(name, res)| acc.add_resolution(ctx, name.to_string(), &res)); |
10 | } | 10 | } |
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index 98cdccef7..86b30e787 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs | |||
@@ -5,7 +5,7 @@ use ra_syntax::{ | |||
5 | algo::{find_token_at_offset, find_covering_element, find_node_at_offset}, | 5 | algo::{find_token_at_offset, find_covering_element, find_node_at_offset}, |
6 | SyntaxKind::*, | 6 | SyntaxKind::*, |
7 | }; | 7 | }; |
8 | use hir::{source_binder, Resolver}; | 8 | use hir::source_binder; |
9 | 9 | ||
10 | use crate::{db, FilePosition}; | 10 | use crate::{db, FilePosition}; |
11 | 11 | ||
@@ -17,7 +17,6 @@ pub(crate) struct CompletionContext<'a> { | |||
17 | pub(super) analyzer: hir::SourceAnalyzer, | 17 | pub(super) analyzer: hir::SourceAnalyzer, |
18 | pub(super) offset: TextUnit, | 18 | pub(super) offset: TextUnit, |
19 | pub(super) token: SyntaxToken<'a>, | 19 | pub(super) token: SyntaxToken<'a>, |
20 | pub(super) resolver: Resolver, | ||
21 | pub(super) module: Option<hir::Module>, | 20 | pub(super) module: Option<hir::Module>, |
22 | pub(super) function_syntax: Option<&'a ast::FnDef>, | 21 | pub(super) function_syntax: Option<&'a ast::FnDef>, |
23 | pub(super) use_item_syntax: Option<&'a ast::UseItem>, | 22 | pub(super) use_item_syntax: Option<&'a ast::UseItem>, |
@@ -47,7 +46,6 @@ impl<'a> CompletionContext<'a> { | |||
47 | original_file: &'a SourceFile, | 46 | original_file: &'a SourceFile, |
48 | position: FilePosition, | 47 | position: FilePosition, |
49 | ) -> Option<CompletionContext<'a>> { | 48 | ) -> Option<CompletionContext<'a>> { |
50 | let resolver = source_binder::resolver_for_position(db, position); | ||
51 | let module = source_binder::module_from_position(db, position); | 49 | let module = source_binder::module_from_position(db, position); |
52 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; | 50 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; |
53 | let analyzer = hir::SourceAnalyzer::new(db, position.file_id, token.parent()); | 51 | let analyzer = hir::SourceAnalyzer::new(db, position.file_id, token.parent()); |
@@ -56,7 +54,6 @@ impl<'a> CompletionContext<'a> { | |||
56 | analyzer, | 54 | analyzer, |
57 | token, | 55 | token, |
58 | offset: position.offset, | 56 | offset: position.offset, |
59 | resolver, | ||
60 | module, | 57 | module, |
61 | function_syntax: None, | 58 | function_syntax: None, |
62 | use_item_syntax: None, | 59 | use_item_syntax: None, |