diff options
Diffstat (limited to 'crates/ra_ide/src/completion/complete_scope.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_scope.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs index 6b0621081..1cb2ed070 100644 --- a/crates/ra_ide/src/completion/complete_scope.rs +++ b/crates/ra_ide/src/completion/complete_scope.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Completion of names from the current scope, e.g. locals and imported items. | 1 | //! Completion of names from the current scope, e.g. locals and imported items. |
2 | 2 | ||
3 | use crate::completion::{CompletionContext, Completions}; | 3 | use crate::completion::{CompletionContext, Completions}; |
4 | use hir::ScopeDef; | 4 | use hir::{ModuleDef, ScopeDef}; |
5 | 5 | ||
6 | pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | 6 | pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { |
7 | if !ctx.is_trivial_path && !ctx.is_pat_binding_and_path { | 7 | if !ctx.is_trivial_path && !ctx.is_pat_binding_and_path { |
@@ -9,7 +9,10 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
9 | } | 9 | } |
10 | 10 | ||
11 | ctx.scope().process_all_names(&mut |name, res| match (ctx.is_pat_binding_and_path, &res) { | 11 | ctx.scope().process_all_names(&mut |name, res| match (ctx.is_pat_binding_and_path, &res) { |
12 | (true, ScopeDef::Local(..)) => {} | 12 | (true, ScopeDef::ModuleDef(ModuleDef::Function(..))) => (), |
13 | (true, ScopeDef::ModuleDef(ModuleDef::Static(..))) => (), | ||
14 | (true, ScopeDef::ModuleDef(ModuleDef::Const(..))) => (), | ||
15 | (true, ScopeDef::Local(..)) => (), | ||
13 | _ => acc.add_resolution(ctx, name.to_string(), &res), | 16 | _ => acc.add_resolution(ctx, name.to_string(), &res), |
14 | }); | 17 | }); |
15 | } | 18 | } |
@@ -71,16 +74,6 @@ mod tests { | |||
71 | insert: "Enum", | 74 | insert: "Enum", |
72 | kind: Enum, | 75 | kind: Enum, |
73 | }, | 76 | }, |
74 | CompletionItem { | ||
75 | label: "quux(…)", | ||
76 | source_range: [231; 233), | ||
77 | delete: [231; 233), | ||
78 | insert: "quux(${1:x})$0", | ||
79 | kind: Function, | ||
80 | lookup: "quux", | ||
81 | detail: "fn quux(x: Option<Enum>)", | ||
82 | trigger_call_info: true, | ||
83 | }, | ||
84 | ] | 77 | ] |
85 | "### | 78 | "### |
86 | ); | 79 | ); |