diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting/highlight.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 9503c936d..7a53268e8 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs | |||
@@ -131,6 +131,9 @@ pub(super) fn element( | |||
131 | } | 131 | } |
132 | STRING | BYTE_STRING => HlTag::StringLiteral.into(), | 132 | STRING | BYTE_STRING => HlTag::StringLiteral.into(), |
133 | ATTR => HlTag::Attribute.into(), | 133 | ATTR => HlTag::Attribute.into(), |
134 | INT_NUMBER if element.ancestors().nth(1).map_or(false, |it| it.kind() == FIELD_EXPR) => { | ||
135 | SymbolKind::Field.into() | ||
136 | } | ||
134 | INT_NUMBER | FLOAT_NUMBER => HlTag::NumericLiteral.into(), | 137 | INT_NUMBER | FLOAT_NUMBER => HlTag::NumericLiteral.into(), |
135 | BYTE => HlTag::ByteLiteral.into(), | 138 | BYTE => HlTag::ByteLiteral.into(), |
136 | CHAR => HlTag::CharLiteral.into(), | 139 | CHAR => HlTag::CharLiteral.into(), |
@@ -446,12 +449,12 @@ fn highlight_method_call( | |||
446 | krate: Option<hir::Crate>, | 449 | krate: Option<hir::Crate>, |
447 | method_call: &ast::MethodCallExpr, | 450 | method_call: &ast::MethodCallExpr, |
448 | ) -> Option<Highlight> { | 451 | ) -> Option<Highlight> { |
449 | let func = sema.resolve_method_call(&method_call)?; | 452 | let func = sema.resolve_method_call(method_call)?; |
450 | 453 | ||
451 | let mut h = SymbolKind::Function.into(); | 454 | let mut h = SymbolKind::Function.into(); |
452 | h |= HlMod::Associated; | 455 | h |= HlMod::Associated; |
453 | 456 | ||
454 | if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { | 457 | if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(method_call) { |
455 | h |= HlMod::Unsafe; | 458 | h |= HlMod::Unsafe; |
456 | } | 459 | } |
457 | if func.is_async(sema.db) { | 460 | if func.is_async(sema.db) { |
@@ -523,11 +526,9 @@ fn highlight_name_ref_by_syntax( | |||
523 | }; | 526 | }; |
524 | 527 | ||
525 | match parent.kind() { | 528 | match parent.kind() { |
526 | METHOD_CALL_EXPR => { | 529 | METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent) |
527 | return ast::MethodCallExpr::cast(parent) | 530 | .and_then(|it| highlight_method_call(sema, krate, &it)) |
528 | .and_then(|it| highlight_method_call(sema, krate, &it)) | 531 | .unwrap_or_else(|| SymbolKind::Function.into()), |
529 | .unwrap_or_else(|| SymbolKind::Function.into()); | ||
530 | } | ||
531 | FIELD_EXPR => { | 532 | FIELD_EXPR => { |
532 | let h = HlTag::Symbol(SymbolKind::Field); | 533 | let h = HlTag::Symbol(SymbolKind::Field); |
533 | let is_union = ast::FieldExpr::cast(parent) | 534 | let is_union = ast::FieldExpr::cast(parent) |