From 1735b3ef6a7c7f7b3f5cdecdbf204c85991bcd63 Mon Sep 17 00:00:00 2001 From: Chetan Khilosiya Date: Tue, 6 Apr 2021 00:09:17 +0530 Subject: 8279: Added initial implementation for Operator semantic highlighting. --- crates/rust-analyzer/src/to_proto.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'crates/rust-analyzer/src/to_proto.rs') diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 2ac31d981..df9292f8e 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -7,9 +7,9 @@ use std::{ use ide::{ Annotation, AnnotationKind, Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, - Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, InsertTextFormat, - Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, - StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, + Highlight, HlMod, HlOperator, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, + InsertTextFormat, Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, + SourceChange, StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, }; use itertools::Itertools; use serde_json::to_value; @@ -445,7 +445,13 @@ fn semantic_token_type_and_modifiers( HlTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER, HlTag::Keyword => lsp_types::SemanticTokenType::KEYWORD, HlTag::None => semantic_tokens::GENERIC, - HlTag::Operator => lsp_types::SemanticTokenType::OPERATOR, + HlTag::Operator(op) => match op { + HlOperator::Bitwise => semantic_tokens::BITWISE, + HlOperator::Arithmetic => semantic_tokens::ARITHMETIC, + HlOperator::Logical => semantic_tokens::LOGICAL, + HlOperator::Comparision => semantic_tokens::COMPARISION, + HlOperator::Other => semantic_tokens::OPERATOR, + }, HlTag::StringLiteral => lsp_types::SemanticTokenType::STRING, HlTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE, HlTag::Punctuation(punct) => match punct { -- cgit v1.2.3