mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Color constants
This commit is contained in:
parent
9784ab9f39
commit
a8e68ff814
3 changed files with 13 additions and 2 deletions
|
@ -20,7 +20,7 @@ use ra_vfs::LineEndings;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
req,
|
req,
|
||||||
semantic_tokens::{self, ModifierSet, BUILTIN, CONTROL, MUTABLE, UNSAFE},
|
semantic_tokens::{self, ModifierSet, BUILTIN, CONSTANT, CONTROL, MUTABLE, UNSAFE},
|
||||||
world::WorldSnapshot,
|
world::WorldSnapshot,
|
||||||
Result,
|
Result,
|
||||||
};
|
};
|
||||||
|
@ -322,7 +322,7 @@ impl Conv for Highlight {
|
||||||
HighlightTag::Constant => {
|
HighlightTag::Constant => {
|
||||||
mods |= SemanticTokenModifier::STATIC;
|
mods |= SemanticTokenModifier::STATIC;
|
||||||
mods |= SemanticTokenModifier::READONLY;
|
mods |= SemanticTokenModifier::READONLY;
|
||||||
SemanticTokenType::VARIABLE
|
CONSTANT
|
||||||
}
|
}
|
||||||
HighlightTag::Macro => SemanticTokenType::MACRO,
|
HighlightTag::Macro => SemanticTokenType::MACRO,
|
||||||
HighlightTag::Variable => SemanticTokenType::VARIABLE,
|
HighlightTag::Variable => SemanticTokenType::VARIABLE,
|
||||||
|
|
|
@ -5,6 +5,7 @@ use std::ops;
|
||||||
use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType};
|
use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType};
|
||||||
|
|
||||||
pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute");
|
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 MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable");
|
||||||
pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe");
|
pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe");
|
||||||
|
@ -33,6 +34,7 @@ pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
|
||||||
SemanticTokenType::PARAMETER,
|
SemanticTokenType::PARAMETER,
|
||||||
SemanticTokenType::LABEL,
|
SemanticTokenType::LABEL,
|
||||||
ATTRIBUTE,
|
ATTRIBUTE,
|
||||||
|
CONSTANT,
|
||||||
];
|
];
|
||||||
|
|
||||||
pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
|
pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
|
||||||
|
|
|
@ -383,6 +383,9 @@
|
||||||
"semanticTokenTypes": [
|
"semanticTokenTypes": [
|
||||||
{
|
{
|
||||||
"id": "attribute"
|
"id": "attribute"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "constant"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"semanticTokenModifiers": [
|
"semanticTokenModifiers": [
|
||||||
|
@ -411,6 +414,12 @@
|
||||||
"highContrast": {
|
"highContrast": {
|
||||||
"fontStyle": "underline"
|
"fontStyle": "underline"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "constant",
|
||||||
|
"scope": [
|
||||||
|
"entity.name.constant"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue