diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html
index 198139220e..352e350955 100644
--- a/crates/ra_ide/src/snapshots/highlighting.html
+++ b/crates/ra_ide/src/snapshots/highlighting.html
@@ -35,12 +35,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
}
trait Bar {
- fn bar(&self) -> i32;
+ fn bar(&self) -> i32;
}
impl Bar for Foo {
- fn bar(&self) -> i32 {
- self.x
+ fn bar(&self) -> i32 {
+ self.x
}
}
@@ -92,7 +92,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
use Option::*;
impl<T> Option<T> {
- fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
+ fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
match other {
None => unimplemented!(),
Nope => Nope,
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 61aeb28cbc..8a995d779b 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -414,6 +414,7 @@ fn highlight_element(
T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow,
T![unsafe] => h | HighlightModifier::Unsafe,
T![true] | T![false] => HighlightTag::BoolLiteral.into(),
+ T![self] => HighlightTag::SelfKeyword.into(),
_ => h,
}
}
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs
index 09652a5b1c..46c718c91e 100644
--- a/crates/ra_ide/src/syntax_highlighting/tags.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tags.rs
@@ -30,6 +30,7 @@ pub enum HighlightTag {
Macro,
Module,
NumericLiteral,
+ SelfKeyword,
SelfType,
Static,
StringLiteral,
@@ -76,6 +77,7 @@ impl HighlightTag {
HighlightTag::Macro => "macro",
HighlightTag::Module => "module",
HighlightTag::NumericLiteral => "numeric_literal",
+ HighlightTag::SelfKeyword => "self_keyword",
HighlightTag::SelfType => "self_type",
HighlightTag::Static => "static",
HighlightTag::StringLiteral => "string_literal",
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs
index 9b775871f0..6f125c37cb 100644
--- a/crates/rust-analyzer/src/semantic_tokens.rs
+++ b/crates/rust-analyzer/src/semantic_tokens.rs
@@ -40,6 +40,7 @@ define_semantic_token_types![
(BUILTIN_TYPE, "builtinType"),
(ENUM_MEMBER, "enumMember"),
(LIFETIME, "lifetime"),
+ (SELF_KEYWORD, "selfKeyword"),
(TYPE_ALIAS, "typeAlias"),
(UNION, "union"),
(UNRESOLVED_REFERENCE, "unresolvedReference"),
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index bb7594dbf3..8e8e7033db 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -286,6 +286,7 @@ fn semantic_token_type_and_modifiers(
HighlightTag::TypeAlias => semantic_tokens::TYPE_ALIAS,
HighlightTag::Trait => lsp_types::SemanticTokenType::INTERFACE,
HighlightTag::BuiltinType => semantic_tokens::BUILTIN_TYPE,
+ HighlightTag::SelfKeyword => semantic_tokens::SELF_KEYWORD,
HighlightTag::SelfType => lsp_types::SemanticTokenType::TYPE,
HighlightTag::Field => lsp_types::SemanticTokenType::PROPERTY,
HighlightTag::Function => lsp_types::SemanticTokenType::FUNCTION,
diff --git a/editors/code/package.json b/editors/code/package.json
index 2f14eaebd2..acf3ca4b59 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -586,6 +586,11 @@
"id": "attribute",
"description": "Style for attributes"
},
+ {
+ "id": "boolean",
+ "description": "Style for boolean literals",
+ "superType": "keyword"
+ },
{
"id": "builtinType",
"description": "Style for builtin types",
@@ -595,6 +600,11 @@
"id": "lifetime",
"description": "Style for lifetimes"
},
+ {
+ "id": "selfKeyword",
+ "description": "Style for the self keyword",
+ "superType": "keyword"
+ },
{
"id": "typeAlias",
"description": "Style for type aliases",