From a8e68ff814801a72ecac6cd918a3e7fbb25d11c0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 23:16:57 +0100 Subject: Color constants --- crates/rust-analyzer/src/conv.rs | 4 ++-- crates/rust-analyzer/src/semantic_tokens.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/conv.rs b/crates/rust-analyzer/src/conv.rs index 86851c1f1..b012f5dd5 100644 --- a/crates/rust-analyzer/src/conv.rs +++ b/crates/rust-analyzer/src/conv.rs @@ -20,7 +20,7 @@ use ra_vfs::LineEndings; use crate::{ req, - semantic_tokens::{self, ModifierSet, BUILTIN, CONTROL, MUTABLE, UNSAFE}, + semantic_tokens::{self, ModifierSet, BUILTIN, CONSTANT, CONTROL, MUTABLE, UNSAFE}, world::WorldSnapshot, Result, }; @@ -322,7 +322,7 @@ impl Conv for Highlight { HighlightTag::Constant => { mods |= SemanticTokenModifier::STATIC; mods |= SemanticTokenModifier::READONLY; - SemanticTokenType::VARIABLE + CONSTANT } HighlightTag::Macro => SemanticTokenType::MACRO, HighlightTag::Variable => SemanticTokenType::VARIABLE, diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index bf21dc68e..d8362409d 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs @@ -5,6 +5,7 @@ use std::ops; use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType}; pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute"); +pub(crate) const CONSTANT: SemanticTokenType = SemanticTokenType::new("constant"); pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable"); pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe"); @@ -33,6 +34,7 @@ pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[ SemanticTokenType::PARAMETER, SemanticTokenType::LABEL, ATTRIBUTE, + CONSTANT, ]; pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ -- cgit v1.2.3