]> git.lizzy.rs Git - rust.git/commitdiff
Add semantic highlight to QUESTION token
authorRoland Ruckerbauer <roland.rucky@gmail.com>
Fri, 29 May 2020 19:17:14 +0000 (21:17 +0200)
committerRoland Ruckerbauer <roland.rucky@gmail.com>
Fri, 29 May 2020 19:17:14 +0000 (21:17 +0200)
Made it an operator with controlFlow modifier.

crates/ra_ide/src/syntax_highlighting.rs
crates/ra_ide/src/syntax_highlighting/tags.rs
crates/rust-analyzer/src/to_proto.rs

index 8a995d779baebefea9c108ff626cae4372ab34da..cd6464b4057506a07b5a01b023a254682634bf6d 100644 (file)
@@ -391,6 +391,7 @@ fn highlight_element(
         INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(),
         BYTE => HighlightTag::ByteLiteral.into(),
         CHAR => HighlightTag::CharLiteral.into(),
+        QUESTION => Highlight::new(HighlightTag::Operator) | HighlightModifier::ControlFlow,
         LIFETIME => {
             let h = Highlight::new(HighlightTag::Lifetime);
             match element.parent().map(|it| it.kind()) {
index 46c718c91e23ebcbf47aeee2b0ea66b07ebeb3cf..1514531de2e384c9fc3ff2d649eb389a7788026e 100644 (file)
@@ -42,6 +42,7 @@ pub enum HighlightTag {
     Local,
     UnresolvedReference,
     FormatSpecifier,
+    Operator,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
@@ -89,6 +90,7 @@ fn as_str(self) -> &'static str {
             HighlightTag::Local => "variable",
             HighlightTag::UnresolvedReference => "unresolved_reference",
             HighlightTag::FormatSpecifier => "format_specifier",
+            HighlightTag::Operator => "operator",
         }
     }
 }
index 8e8e7033db768d31b1599c598ac6e28762741d6a..2fbbb4e632d9fef856adf50323fe5b731662f608 100644 (file)
@@ -317,6 +317,7 @@ fn semantic_token_type_and_modifiers(
         HighlightTag::Keyword => lsp_types::SemanticTokenType::KEYWORD,
         HighlightTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE,
         HighlightTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER,
+        HighlightTag::Operator => lsp_types::SemanticTokenType::OPERATOR,
     };
 
     for modifier in highlight.modifiers.iter() {