diff options
Diffstat (limited to 'crates/ra_ide_db/src')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_db/src/marks.rs | 1 |
2 files changed, 10 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) { |
diff --git a/crates/ra_ide_db/src/marks.rs b/crates/ra_ide_db/src/marks.rs index 4f0a22af0..03b4be21c 100644 --- a/crates/ra_ide_db/src/marks.rs +++ b/crates/ra_ide_db/src/marks.rs | |||
@@ -6,5 +6,6 @@ test_utils::marks![ | |||
6 | goto_def_for_fields | 6 | goto_def_for_fields |
7 | goto_def_for_record_fields | 7 | goto_def_for_record_fields |
8 | goto_def_for_field_init_shorthand | 8 | goto_def_for_field_init_shorthand |
9 | goto_def_for_record_field_pats | ||
9 | search_filters_by_range | 10 | search_filters_by_range |
10 | ]; | 11 | ]; |