aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion/complete_scope.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-03 18:59:28 +0100
committerAleksey Kladov <[email protected]>2020-04-03 20:00:15 +0100
commitadbcedde1812b728726419f24000bf123b22fef9 (patch)
tree1bc2cd72a1fc81f49fef36c408d82ebdb3207969 /crates/ra_ide/src/completion/complete_scope.rs
parent6a2dd7bafc24ac405aebf29f04120ca071019e92 (diff)
Remove the second code-path for completing names in patterns
Diffstat (limited to 'crates/ra_ide/src/completion/complete_scope.rs')
-rw-r--r--crates/ra_ide/src/completion/complete_scope.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs
index 2ca552733..665597e4c 100644
--- a/crates/ra_ide/src/completion/complete_scope.rs
+++ b/crates/ra_ide/src/completion/complete_scope.rs
@@ -1,19 +1,13 @@
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
3use crate::completion::{CompletionContext, Completions}; 3use crate::completion::{CompletionContext, Completions};
4use hir::{ModuleDef, ScopeDef};
5 4
6pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { 5pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
7 if !ctx.is_trivial_path && !ctx.is_pat_binding_and_path { 6 if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const) {
8 return; 7 return;
9 } 8 }
10 9
11 ctx.scope().process_all_names(&mut |name, res| match (ctx.is_pat_binding_and_path, &res) { 10 ctx.scope().process_all_names(&mut |name, res| acc.add_resolution(ctx, name.to_string(), &res));
12 (true, ScopeDef::ModuleDef(ModuleDef::Function(..))) => (),
13 (true, ScopeDef::ModuleDef(ModuleDef::Static(..))) => (),
14 (true, ScopeDef::Local(..)) => (),
15 _ => acc.add_resolution(ctx, name.to_string(), &res),
16 });
17} 11}
18 12
19#[cfg(test)] 13#[cfg(test)]