diff options
author | Lukas Tobias Wirth <[email protected]> | 2021-05-06 16:05:49 +0100 |
---|---|---|
committer | Lukas Tobias Wirth <[email protected]> | 2021-05-06 16:05:49 +0100 |
commit | d97a4b8e49df118a13a122225474bcbd011c0ea1 (patch) | |
tree | f1004fe3c662aaa0f386aea174a106a6ab4bdca5 /crates/ide | |
parent | 5b663f1b07233442a3b0b58db453504dcc51ddc9 (diff) |
Support goto_type_definition for types
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/goto_type_definition.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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( | |||
30 | ast::Expr(it) => sema.type_of_expr(&it)?, | 30 | ast::Expr(it) => sema.type_of_expr(&it)?, |
31 | ast::Pat(it) => sema.type_of_pat(&it)?, | 31 | ast::Pat(it) => sema.type_of_pat(&it)?, |
32 | ast::SelfParam(it) => sema.type_of_self(&it)?, | 32 | ast::SelfParam(it) => sema.type_of_self(&it)?, |
33 | ast::Type(it) => sema.resolve_type(&it)?, | ||
33 | _ => return None, | 34 | _ => return None, |
34 | } | 35 | } |
35 | }; | 36 | }; |
@@ -149,4 +150,15 @@ impl Foo { | |||
149 | "#, | 150 | "#, |
150 | ) | 151 | ) |
151 | } | 152 | } |
153 | |||
154 | #[test] | ||
155 | fn goto_def_for_type_fallback() { | ||
156 | check( | ||
157 | r#" | ||
158 | struct Foo; | ||
159 | //^^^ | ||
160 | impl Foo$0 {} | ||
161 | "#, | ||
162 | ) | ||
163 | } | ||
152 | } | 164 | } |