diff options
Diffstat (limited to 'crates/ra_ide_db/src/defs.rs')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 49a8c74fb..785613b82 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -180,6 +180,7 @@ fn classify_name_inner(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Opti | |||
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | #[derive(Debug)] | ||
183 | pub enum NameRefClass { | 184 | pub enum NameRefClass { |
184 | Definition(Definition), | 185 | Definition(Definition), |
185 | FieldShorthand { local: Local, field: Definition }, | 186 | FieldShorthand { local: Local, field: Definition }, |
@@ -229,6 +230,14 @@ pub fn classify_name_ref( | |||
229 | } | 230 | } |
230 | } | 231 | } |
231 | 232 | ||
233 | if let Some(record_field_pat) = ast::RecordFieldPat::cast(parent.clone()) { | ||
234 | tested_by!(goto_def_for_record_field_pats; force); | ||
235 | if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { | ||
236 | let field = Definition::StructField(field); | ||
237 | return Some(NameRefClass::Definition(field)); | ||
238 | } | ||
239 | } | ||
240 | |||
232 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { | 241 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { |
233 | tested_by!(goto_def_for_macros; force); | 242 | tested_by!(goto_def_for_macros; force); |
234 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { | 243 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { |