diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-13 12:46:23 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-13 12:46:23 +0100 |
commit | 03e0bf7f555ad4f3c8e127e009897b6fa83a6194 (patch) | |
tree | 2d0cc7aa47b2080aae6ff4900a8ad11df6f8755e /crates/rust-analyzer | |
parent | e6728a8cd39f9111dcdd654c7c65e99e5a2f1190 (diff) | |
parent | b232549653fa3477dec0585e7bdfe637d7aaf31e (diff) |
Merge #8354
8354: Distinguishing between different operators in semantic highlighting r=matklad a=chetankhilosiya
Co-authored-by: Chetan Khilosiya <[email protected]>
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index 2dc8a42f1..adc059817 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -39,7 +39,9 @@ macro_rules! define_semantic_token_types { | |||
39 | 39 | ||
40 | define_semantic_token_types![ | 40 | define_semantic_token_types![ |
41 | (ANGLE, "angle"), | 41 | (ANGLE, "angle"), |
42 | (ARITHMETIC, "arithmetic"), | ||
42 | (ATTRIBUTE, "attribute"), | 43 | (ATTRIBUTE, "attribute"), |
44 | (BITWISE, "bitwise"), | ||
43 | (BOOLEAN, "boolean"), | 45 | (BOOLEAN, "boolean"), |
44 | (BRACE, "brace"), | 46 | (BRACE, "brace"), |
45 | (BRACKET, "bracket"), | 47 | (BRACKET, "bracket"), |
@@ -47,6 +49,7 @@ define_semantic_token_types![ | |||
47 | (CHAR_LITERAL, "characterLiteral"), | 49 | (CHAR_LITERAL, "characterLiteral"), |
48 | (COLON, "colon"), | 50 | (COLON, "colon"), |
49 | (COMMA, "comma"), | 51 | (COMMA, "comma"), |
52 | (COMPARISION, "comparision"), | ||
50 | (CONST_PARAMETER, "constParameter"), | 53 | (CONST_PARAMETER, "constParameter"), |
51 | (DOT, "dot"), | 54 | (DOT, "dot"), |
52 | (ESCAPE_SEQUENCE, "escapeSequence"), | 55 | (ESCAPE_SEQUENCE, "escapeSequence"), |
@@ -54,6 +57,8 @@ define_semantic_token_types![ | |||
54 | (GENERIC, "generic"), | 57 | (GENERIC, "generic"), |
55 | (LABEL, "label"), | 58 | (LABEL, "label"), |
56 | (LIFETIME, "lifetime"), | 59 | (LIFETIME, "lifetime"), |
60 | (LOGICAL, "logical"), | ||
61 | (OPERATOR, "operator"), | ||
57 | (PARENTHESIS, "parenthesis"), | 62 | (PARENTHESIS, "parenthesis"), |
58 | (PUNCTUATION, "punctuation"), | 63 | (PUNCTUATION, "punctuation"), |
59 | (SELF_KEYWORD, "selfKeyword"), | 64 | (SELF_KEYWORD, "selfKeyword"), |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 53852bfdc..8d7cb9b74 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -7,9 +7,9 @@ use std::{ | |||
7 | use ide::{ | 7 | use ide::{ |
8 | Annotation, AnnotationKind, Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, | 8 | Annotation, AnnotationKind, Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, |
9 | CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, | 9 | CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, |
10 | Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, InsertTextFormat, | 10 | Highlight, HlMod, HlOperator, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, |
11 | Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, | 11 | InsertTextFormat, Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, |
12 | StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, | 12 | SourceChange, StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, |
13 | }; | 13 | }; |
14 | use itertools::Itertools; | 14 | use itertools::Itertools; |
15 | use serde_json::to_value; | 15 | use serde_json::to_value; |
@@ -463,7 +463,13 @@ fn semantic_token_type_and_modifiers( | |||
463 | HlTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER, | 463 | HlTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER, |
464 | HlTag::Keyword => lsp_types::SemanticTokenType::KEYWORD, | 464 | HlTag::Keyword => lsp_types::SemanticTokenType::KEYWORD, |
465 | HlTag::None => semantic_tokens::GENERIC, | 465 | HlTag::None => semantic_tokens::GENERIC, |
466 | HlTag::Operator => lsp_types::SemanticTokenType::OPERATOR, | 466 | HlTag::Operator(op) => match op { |
467 | HlOperator::Bitwise => semantic_tokens::BITWISE, | ||
468 | HlOperator::Arithmetic => semantic_tokens::ARITHMETIC, | ||
469 | HlOperator::Logical => semantic_tokens::LOGICAL, | ||
470 | HlOperator::Comparision => semantic_tokens::COMPARISION, | ||
471 | HlOperator::Other => semantic_tokens::OPERATOR, | ||
472 | }, | ||
467 | HlTag::StringLiteral => lsp_types::SemanticTokenType::STRING, | 473 | HlTag::StringLiteral => lsp_types::SemanticTokenType::STRING, |
468 | HlTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE, | 474 | HlTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE, |
469 | HlTag::Punctuation(punct) => match punct { | 475 | HlTag::Punctuation(punct) => match punct { |