From d97a4b8e49df118a13a122225474bcbd011c0ea1 Mon Sep 17 00:00:00 2001 From: Lukas Tobias Wirth Date: Thu, 6 May 2021 17:05:49 +0200 Subject: Support goto_type_definition for types --- crates/ide/src/goto_type_definition.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ide') diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs index 9d34b109b..f3284bb96 100644 --- a/crates/ide/src/goto_type_definition.rs +++ b/crates/ide/src/goto_type_definition.rs @@ -30,6 +30,7 @@ pub(crate) fn goto_type_definition( ast::Expr(it) => sema.type_of_expr(&it)?, ast::Pat(it) => sema.type_of_pat(&it)?, ast::SelfParam(it) => sema.type_of_self(&it)?, + ast::Type(it) => sema.resolve_type(&it)?, _ => return None, } }; @@ -146,6 +147,17 @@ struct Foo; impl Foo { fn f(&self$0) {} } +"#, + ) + } + + #[test] + fn goto_def_for_type_fallback() { + check( + r#" +struct Foo; + //^^^ +impl Foo$0 {} "#, ) } -- cgit v1.2.3