From e1d6b7f7c48d82c3c03550bc702e64cd7d079c99 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Jul 2020 14:50:00 +0200 Subject: Use dedicated semantic highlight tag for parameters closes #5106 --- crates/ra_ide/src/syntax_highlighting.rs | 5 +++-- crates/ra_ide/src/syntax_highlighting/html.rs | 5 +++-- crates/ra_ide/src/syntax_highlighting/tags.rs | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 028b55902..5bb6f9642 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -630,9 +630,10 @@ fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { }, Definition::SelfType(_) => HighlightTag::SelfType, Definition::TypeParam(_) => HighlightTag::TypeParam, - // FIXME: distinguish between locals and parameters Definition::Local(local) => { - let mut h = Highlight::new(HighlightTag::Local); + let tag = + if local.is_param(db) { HighlightTag::ValueParam } else { HighlightTag::Local }; + let mut h = Highlight::new(tag); if local.is_mut(db) || local.ty(db).is_mutable_reference() { h |= HighlightModifier::Mutable; } diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs index 0c74f7370..0be55bca9 100644 --- a/crates/ra_ide/src/syntax_highlighting/html.rs +++ b/crates/ra_ide/src/syntax_highlighting/html.rs @@ -83,14 +83,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .bool_literal { color: #BFE6EB; } .macro { color: #94BFF3; } .module { color: #AFD8AF; } +.value_param { color: #DCDCCC; } .variable { color: #DCDCCC; } .format_specifier { color: #CC696B; } .mutable { text-decoration: underline; } -.unresolved_reference { color: #FC5555; } .escape_sequence { color: #94BFF3; } - .keyword { color: #F0DFAF; font-weight: bold; } .keyword.unsafe { color: #BC8383; font-weight: bold; } .control { font-style: italic; } + +.unresolved_reference { color: #FC5555; text-decoration: wavy underline; } "; diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index 13d9dd195..719c6ed3c 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs @@ -41,6 +41,7 @@ pub enum HighlightTag { TypeAlias, TypeParam, Union, + ValueParam, Local, UnresolvedReference, FormatSpecifier, @@ -95,6 +96,7 @@ impl HighlightTag { HighlightTag::TypeAlias => "type_alias", HighlightTag::TypeParam => "type_param", HighlightTag::Union => "union", + HighlightTag::ValueParam => "value_param", HighlightTag::Local => "variable", HighlightTag::UnresolvedReference => "unresolved_reference", } -- cgit v1.2.3