diff options
-rw-r--r-- | crates/rust-analyzer/src/conv.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 2 | ||||
-rw-r--r-- | editors/code/package.json | 9 |
3 files changed, 13 insertions, 2 deletions
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; | |||
20 | 20 | ||
21 | use crate::{ | 21 | use crate::{ |
22 | req, | 22 | req, |
23 | semantic_tokens::{self, ModifierSet, BUILTIN, CONTROL, MUTABLE, UNSAFE}, | 23 | semantic_tokens::{self, ModifierSet, BUILTIN, CONSTANT, CONTROL, MUTABLE, UNSAFE}, |
24 | world::WorldSnapshot, | 24 | world::WorldSnapshot, |
25 | Result, | 25 | Result, |
26 | }; | 26 | }; |
@@ -322,7 +322,7 @@ impl Conv for Highlight { | |||
322 | HighlightTag::Constant => { | 322 | HighlightTag::Constant => { |
323 | mods |= SemanticTokenModifier::STATIC; | 323 | mods |= SemanticTokenModifier::STATIC; |
324 | mods |= SemanticTokenModifier::READONLY; | 324 | mods |= SemanticTokenModifier::READONLY; |
325 | SemanticTokenType::VARIABLE | 325 | CONSTANT |
326 | } | 326 | } |
327 | HighlightTag::Macro => SemanticTokenType::MACRO, | 327 | HighlightTag::Macro => SemanticTokenType::MACRO, |
328 | HighlightTag::Variable => SemanticTokenType::VARIABLE, | 328 | 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; | |||
5 | use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType}; | 5 | use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType}; |
6 | 6 | ||
7 | pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute"); | 7 | pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute"); |
8 | pub(crate) const CONSTANT: SemanticTokenType = SemanticTokenType::new("constant"); | ||
8 | 9 | ||
9 | pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable"); | 10 | pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable"); |
10 | pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe"); | 11 | pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe"); |
@@ -33,6 +34,7 @@ pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[ | |||
33 | SemanticTokenType::PARAMETER, | 34 | SemanticTokenType::PARAMETER, |
34 | SemanticTokenType::LABEL, | 35 | SemanticTokenType::LABEL, |
35 | ATTRIBUTE, | 36 | ATTRIBUTE, |
37 | CONSTANT, | ||
36 | ]; | 38 | ]; |
37 | 39 | ||
38 | pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ | 40 | pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ |
diff --git a/editors/code/package.json b/editors/code/package.json index 3fbf3f0bb..ad1101603 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -383,6 +383,9 @@ | |||
383 | "semanticTokenTypes": [ | 383 | "semanticTokenTypes": [ |
384 | { | 384 | { |
385 | "id": "attribute" | 385 | "id": "attribute" |
386 | }, | ||
387 | { | ||
388 | "id": "constant" | ||
386 | } | 389 | } |
387 | ], | 390 | ], |
388 | "semanticTokenModifiers": [ | 391 | "semanticTokenModifiers": [ |
@@ -411,6 +414,12 @@ | |||
411 | "highContrast": { | 414 | "highContrast": { |
412 | "fontStyle": "underline" | 415 | "fontStyle": "underline" |
413 | } | 416 | } |
417 | }, | ||
418 | { | ||
419 | "selector": "constant", | ||
420 | "scope": [ | ||
421 | "entity.name.constant" | ||
422 | ] | ||
414 | } | 423 | } |
415 | ] | 424 | ] |
416 | } | 425 | } |