diff options
author | Aleksey Kladov <[email protected]> | 2020-10-15 16:18:07 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-10-15 16:37:55 +0100 |
commit | f9c1336873d65805ad34129939d800dbf59daf61 (patch) | |
tree | 6ab5f2b70691fb4dc1098769459741e54d0d3807 /crates/ide/src | |
parent | bc287b8f9b7711a38d97be3b619758bb05d54c45 (diff) |
More clarifications
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/doc_links.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/references.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 71382f13e..5e4147362 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -233,7 +233,7 @@ pub(crate) fn external_docs( | |||
233 | let definition = match_ast! { | 233 | let definition = match_ast! { |
234 | match node { | 234 | match node { |
235 | ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), | 235 | ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), |
236 | ast::Name(name) => classify_name(&sema, &name).map(|d| d.definition_or_reference(sema.db)), | 236 | ast::Name(name) => classify_name(&sema, &name).map(|d| d.reference_or_definition(sema.db)), |
237 | _ => None, | 237 | _ => None, |
238 | } | 238 | } |
239 | }; | 239 | }; |
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 79fdb75ed..be2f81aab 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -40,7 +40,7 @@ pub(crate) fn goto_definition( | |||
40 | reference_definition(&sema, &name_ref).to_vec() | 40 | reference_definition(&sema, &name_ref).to_vec() |
41 | }, | 41 | }, |
42 | ast::Name(name) => { | 42 | ast::Name(name) => { |
43 | let def = classify_name(&sema, &name)?.definition_or_reference(sema.db); | 43 | let def = classify_name(&sema, &name)?.reference_or_definition(sema.db); |
44 | let nav = def.try_to_nav(sema.db)?; | 44 | let nav = def.try_to_nav(sema.db)?; |
45 | vec![nav] | 45 | vec![nav] |
46 | }, | 46 | }, |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index ec64207d2..95d872b83 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -132,7 +132,7 @@ fn find_name( | |||
132 | opt_name: Option<ast::Name>, | 132 | opt_name: Option<ast::Name>, |
133 | ) -> Option<RangeInfo<Definition>> { | 133 | ) -> Option<RangeInfo<Definition>> { |
134 | if let Some(name) = opt_name { | 134 | if let Some(name) = opt_name { |
135 | let def = classify_name(sema, &name)?.definition_or_reference(sema.db); | 135 | let def = classify_name(sema, &name)?.reference_or_definition(sema.db); |
136 | let range = name.syntax().text_range(); | 136 | let range = name.syntax().text_range(); |
137 | return Some(RangeInfo::new(range, def)); | 137 | return Some(RangeInfo::new(range, def)); |
138 | } | 138 | } |
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 4d8cd98c7..928f771a9 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -459,9 +459,9 @@ fn highlight_element( | |||
459 | highlight_def(db, def) | HighlightModifier::Definition | 459 | highlight_def(db, def) | HighlightModifier::Definition |
460 | } | 460 | } |
461 | Some(NameClass::ConstReference(def)) => highlight_def(db, def), | 461 | Some(NameClass::ConstReference(def)) => highlight_def(db, def), |
462 | Some(NameClass::PatFieldShorthand { field, .. }) => { | 462 | Some(NameClass::PatFieldShorthand { field_ref, .. }) => { |
463 | let mut h = HighlightTag::Field.into(); | 463 | let mut h = HighlightTag::Field.into(); |
464 | if let Definition::Field(field) = field { | 464 | if let Definition::Field(field) = field_ref { |
465 | if let VariantDef::Union(_) = field.parent_def(db) { | 465 | if let VariantDef::Union(_) = field.parent_def(db) { |
466 | h |= HighlightModifier::Unsafe; | 466 | h |= HighlightModifier::Unsafe; |
467 | } | 467 | } |