diff options
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tags.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 1 | ||||
-rw-r--r-- | editors/code/package.json | 5 |
6 files changed, 14 insertions, 4 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 198139220..352e35095 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 | |||
35 | } | 35 | } |
36 | 36 | ||
37 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> { | 37 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> { |
38 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="keyword">self</span>) -> <span class="builtin_type">i32</span>; | 38 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span>; |
39 | } | 39 | } |
40 | 40 | ||
41 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> { | 41 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> { |
42 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="keyword">self</span>) -> <span class="builtin_type">i32</span> { | 42 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span> { |
43 | <span class="keyword">self</span>.<span class="field">x</span> | 43 | <span class="self_keyword">self</span>.<span class="field">x</span> |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
@@ -92,7 +92,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
92 | <span class="keyword">use</span> <span class="enum">Option</span>::*; | 92 | <span class="keyword">use</span> <span class="enum">Option</span>::*; |
93 | 93 | ||
94 | <span class="keyword">impl</span><<span class="type_param declaration">T</span>> <span class="enum">Option</span><<span class="type_param">T</span>> { | 94 | <span class="keyword">impl</span><<span class="type_param declaration">T</span>> <span class="enum">Option</span><<span class="type_param">T</span>> { |
95 | <span class="keyword">fn</span> <span class="function declaration">and</span><<span class="type_param declaration">U</span>>(<span class="keyword">self</span>, <span class="variable declaration">other</span>: <span class="enum">Option</span><<span class="type_param">U</span>>) -> <span class="enum">Option</span><(<span class="type_param">T</span>, <span class="type_param">U</span>)> { | 95 | <span class="keyword">fn</span> <span class="function declaration">and</span><<span class="type_param declaration">U</span>>(<span class="self_keyword">self</span>, <span class="variable declaration">other</span>: <span class="enum">Option</span><<span class="type_param">U</span>>) -> <span class="enum">Option</span><(<span class="type_param">T</span>, <span class="type_param">U</span>)> { |
96 | <span class="keyword control">match</span> <span class="variable">other</span> { | 96 | <span class="keyword control">match</span> <span class="variable">other</span> { |
97 | <span class="enum_variant">None</span> => <span class="macro">unimplemented!</span>(), | 97 | <span class="enum_variant">None</span> => <span class="macro">unimplemented!</span>(), |
98 | <span class="variable declaration">Nope</span> => <span class="variable">Nope</span>, | 98 | <span class="variable declaration">Nope</span> => <span class="variable">Nope</span>, |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 61aeb28cb..8a995d779 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -414,6 +414,7 @@ fn highlight_element( | |||
414 | T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow, | 414 | T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow, |
415 | T![unsafe] => h | HighlightModifier::Unsafe, | 415 | T![unsafe] => h | HighlightModifier::Unsafe, |
416 | T![true] | T![false] => HighlightTag::BoolLiteral.into(), | 416 | T![true] | T![false] => HighlightTag::BoolLiteral.into(), |
417 | T![self] => HighlightTag::SelfKeyword.into(), | ||
417 | _ => h, | 418 | _ => h, |
418 | } | 419 | } |
419 | } | 420 | } |
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index 09652a5b1..46c718c91 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 { | |||
30 | Macro, | 30 | Macro, |
31 | Module, | 31 | Module, |
32 | NumericLiteral, | 32 | NumericLiteral, |
33 | SelfKeyword, | ||
33 | SelfType, | 34 | SelfType, |
34 | Static, | 35 | Static, |
35 | StringLiteral, | 36 | StringLiteral, |
@@ -76,6 +77,7 @@ impl HighlightTag { | |||
76 | HighlightTag::Macro => "macro", | 77 | HighlightTag::Macro => "macro", |
77 | HighlightTag::Module => "module", | 78 | HighlightTag::Module => "module", |
78 | HighlightTag::NumericLiteral => "numeric_literal", | 79 | HighlightTag::NumericLiteral => "numeric_literal", |
80 | HighlightTag::SelfKeyword => "self_keyword", | ||
79 | HighlightTag::SelfType => "self_type", | 81 | HighlightTag::SelfType => "self_type", |
80 | HighlightTag::Static => "static", | 82 | HighlightTag::Static => "static", |
81 | HighlightTag::StringLiteral => "string_literal", | 83 | HighlightTag::StringLiteral => "string_literal", |
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index 9b775871f..6f125c37c 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![ | |||
40 | (BUILTIN_TYPE, "builtinType"), | 40 | (BUILTIN_TYPE, "builtinType"), |
41 | (ENUM_MEMBER, "enumMember"), | 41 | (ENUM_MEMBER, "enumMember"), |
42 | (LIFETIME, "lifetime"), | 42 | (LIFETIME, "lifetime"), |
43 | (SELF_KEYWORD, "selfKeyword"), | ||
43 | (TYPE_ALIAS, "typeAlias"), | 44 | (TYPE_ALIAS, "typeAlias"), |
44 | (UNION, "union"), | 45 | (UNION, "union"), |
45 | (UNRESOLVED_REFERENCE, "unresolvedReference"), | 46 | (UNRESOLVED_REFERENCE, "unresolvedReference"), |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 81a347247..ebaad4d19 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -274,6 +274,7 @@ fn semantic_token_type_and_modifiers( | |||
274 | HighlightTag::TypeAlias => semantic_tokens::TYPE_ALIAS, | 274 | HighlightTag::TypeAlias => semantic_tokens::TYPE_ALIAS, |
275 | HighlightTag::Trait => lsp_types::SemanticTokenType::INTERFACE, | 275 | HighlightTag::Trait => lsp_types::SemanticTokenType::INTERFACE, |
276 | HighlightTag::BuiltinType => semantic_tokens::BUILTIN_TYPE, | 276 | HighlightTag::BuiltinType => semantic_tokens::BUILTIN_TYPE, |
277 | HighlightTag::SelfKeyword => semantic_tokens::SELF_KEYWORD, | ||
277 | HighlightTag::SelfType => lsp_types::SemanticTokenType::TYPE, | 278 | HighlightTag::SelfType => lsp_types::SemanticTokenType::TYPE, |
278 | HighlightTag::Field => lsp_types::SemanticTokenType::PROPERTY, | 279 | HighlightTag::Field => lsp_types::SemanticTokenType::PROPERTY, |
279 | HighlightTag::Function => lsp_types::SemanticTokenType::FUNCTION, | 280 | HighlightTag::Function => lsp_types::SemanticTokenType::FUNCTION, |
diff --git a/editors/code/package.json b/editors/code/package.json index 2f14eaebd..3127e6a30 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -596,6 +596,11 @@ | |||
596 | "description": "Style for lifetimes" | 596 | "description": "Style for lifetimes" |
597 | }, | 597 | }, |
598 | { | 598 | { |
599 | "id": "selfKeyword", | ||
600 | "description": "Style for the self keyword", | ||
601 | "superType": "keyword" | ||
602 | }, | ||
603 | { | ||
599 | "id": "typeAlias", | 604 | "id": "typeAlias", |
600 | "description": "Style for type aliases", | 605 | "description": "Style for type aliases", |
601 | "superType": "type" | 606 | "superType": "type" |