Skip to content

Commit 13451d3

Browse files
committed
Complete methods when receiver is a macro
1 parent 4fe4c30 commit 13451d3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/hir_expand/src/db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
389389
CALL_EXPR => FragmentKind::Expr,
390390
INDEX_EXPR => FragmentKind::Expr,
391391
METHOD_CALL_EXPR => FragmentKind::Expr,
392+
FIELD_EXPR => FragmentKind::Expr,
392393
AWAIT_EXPR => FragmentKind::Expr,
393394
CAST_EXPR => FragmentKind::Expr,
394395
REF_EXPR => FragmentKind::Expr,

crates/ide/src/completion/complete_dot.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,19 @@ fn foo() {
413413
"#]],
414414
);
415415
}
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+
}
416431
}

0 commit comments

Comments
 (0)