diff options
author | Aleksey Kladov <[email protected]> | 2020-10-17 22:43:13 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-10-17 22:43:13 +0100 |
commit | 13451d3dc4477cc1dab38d6d66643de4bd4aa59e (patch) | |
tree | 7f71f488514e4885765d3a8548ad20832e6310b6 /crates | |
parent | 4fe4c30436986318dad339ce1ece2ae698a99303 (diff) |
Complete methods when receiver is a macro
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_expand/src/db.rs | 1 | ||||
-rw-r--r-- | crates/ide/src/completion/complete_dot.rs | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index b591130ca..ade57ac1b 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs | |||
@@ -389,6 +389,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind { | |||
389 | CALL_EXPR => FragmentKind::Expr, | 389 | CALL_EXPR => FragmentKind::Expr, |
390 | INDEX_EXPR => FragmentKind::Expr, | 390 | INDEX_EXPR => FragmentKind::Expr, |
391 | METHOD_CALL_EXPR => FragmentKind::Expr, | 391 | METHOD_CALL_EXPR => FragmentKind::Expr, |
392 | FIELD_EXPR => FragmentKind::Expr, | ||
392 | AWAIT_EXPR => FragmentKind::Expr, | 393 | AWAIT_EXPR => FragmentKind::Expr, |
393 | CAST_EXPR => FragmentKind::Expr, | 394 | CAST_EXPR => FragmentKind::Expr, |
394 | REF_EXPR => FragmentKind::Expr, | 395 | REF_EXPR => FragmentKind::Expr, |
diff --git a/crates/ide/src/completion/complete_dot.rs b/crates/ide/src/completion/complete_dot.rs index 0b9f1798a..f0f9a7f1d 100644 --- a/crates/ide/src/completion/complete_dot.rs +++ b/crates/ide/src/completion/complete_dot.rs | |||
@@ -413,4 +413,19 @@ fn foo() { | |||
413 | "#]], | 413 | "#]], |
414 | ); | 414 | ); |
415 | } | 415 | } |
416 | |||
417 | #[test] | ||
418 | fn completes_method_call_when_receiver_is_a_macro_call() { | ||
419 | check( | ||
420 | r#" | ||
421 | struct S; | ||
422 | impl S { fn foo(&self) {} } | ||
423 | macro_rules! make_s { () => { S }; } | ||
424 | fn main() { make_s!().f<|>; } | ||
425 | "#, | ||
426 | expect![[r#" | ||
427 | me foo() fn foo(&self) | ||
428 | "#]], | ||
429 | ) | ||
430 | } | ||
416 | } | 431 | } |