aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions/unqualified_path.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-05-28 14:09:10 +0100
committerLukas Wirth <[email protected]>2021-05-31 14:10:20 +0100
commit4507382f2e66cd0e6498228bfdffb16769063b0f (patch)
treea3f95f4b5bdaa8e1d5f861e169d66ecb8e7723da /crates/ide_completion/src/completions/unqualified_path.rs
parentd346f5bf75bfe3c7dc357c748c257569c0fb23c3 (diff)
Move unprefixed field/method completion to `dot`
Diffstat (limited to 'crates/ide_completion/src/completions/unqualified_path.rs')
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs46
1 files changed, 0 insertions, 46 deletions
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 83cb67101..20188a7dd 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -47,22 +47,6 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
47 cov_mark::hit!(skip_lifetime_completion); 47 cov_mark::hit!(skip_lifetime_completion);
48 return; 48 return;
49 } 49 }
50 if let ScopeDef::Local(local) = &res {
51 if local.is_self(ctx.db) {
52 let ty = local.ty(ctx.db);
53 super::complete_fields(ctx, &ty, |field, ty| match field {
54 either::Either::Left(field) => {
55 acc.add_field(ctx, Some(name.clone()), field, &ty)
56 }
57 either::Either::Right(tuple_idx) => {
58 acc.add_tuple_field(ctx, Some(name.clone()), tuple_idx, &ty)
59 }
60 });
61 super::complete_methods(ctx, &ty, |func| {
62 acc.add_method(ctx, func, Some(name.clone()), None)
63 });
64 }
65 }
66 acc.add_resolution(ctx, name, &res); 50 acc.add_resolution(ctx, name, &res);
67 }); 51 });
68} 52}
@@ -394,36 +378,6 @@ fn foo() {
394 } 378 }
395 379
396 #[test] 380 #[test]
397 fn completes_qualified_fields_and_methods_in_methods() {
398 check(
399 r#"
400struct Foo { field: i32 }
401
402impl Foo { fn foo(&self) { $0 } }"#,
403 expect![[r#"
404 fd self.field i32
405 me self.foo() fn(&self)
406 lc self &Foo
407 sp Self
408 st Foo
409 "#]],
410 );
411 check(
412 r#"
413struct Foo(i32);
414
415impl Foo { fn foo(&mut self) { $0 } }"#,
416 expect![[r#"
417 fd self.0 i32
418 me self.foo() fn(&mut self)
419 lc self &mut Foo
420 sp Self
421 st Foo
422 "#]],
423 );
424 }
425
426 #[test]
427 fn completes_prelude() { 381 fn completes_prelude() {
428 check( 382 check(
429 r#" 383 r#"