mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Auto merge of #17074 - Veykril:hl, r=Veykril
Add Static and Const highlighting token types
This commit is contained in:
commit
b223860c0e
7 changed files with 142 additions and 102 deletions
|
@ -444,7 +444,6 @@ pub(super) fn highlight_def(
|
||||||
Definition::Variant(_) => Highlight::new(HlTag::Symbol(SymbolKind::Variant)),
|
Definition::Variant(_) => Highlight::new(HlTag::Symbol(SymbolKind::Variant)),
|
||||||
Definition::Const(konst) => {
|
Definition::Const(konst) => {
|
||||||
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Const)) | HlMod::Const;
|
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Const)) | HlMod::Const;
|
||||||
|
|
||||||
if let Some(item) = konst.as_assoc_item(db) {
|
if let Some(item) = konst.as_assoc_item(db) {
|
||||||
h |= HlMod::Associated;
|
h |= HlMod::Associated;
|
||||||
h |= HlMod::Static;
|
h |= HlMod::Static;
|
||||||
|
|
|
@ -77,6 +77,7 @@ pub enum HlMod {
|
||||||
Library,
|
Library,
|
||||||
/// Used to differentiate individual elements within macro calls.
|
/// Used to differentiate individual elements within macro calls.
|
||||||
Macro,
|
Macro,
|
||||||
|
/// Used to differentiate individual elements within proc-macro calls.
|
||||||
ProcMacro,
|
ProcMacro,
|
||||||
/// Mutable binding.
|
/// Mutable binding.
|
||||||
Mutable,
|
Mutable,
|
||||||
|
@ -225,8 +226,8 @@ impl HlMod {
|
||||||
HlMod::IntraDocLink,
|
HlMod::IntraDocLink,
|
||||||
HlMod::Library,
|
HlMod::Library,
|
||||||
HlMod::Macro,
|
HlMod::Macro,
|
||||||
HlMod::ProcMacro,
|
|
||||||
HlMod::Mutable,
|
HlMod::Mutable,
|
||||||
|
HlMod::ProcMacro,
|
||||||
HlMod::Public,
|
HlMod::Public,
|
||||||
HlMod::Reference,
|
HlMod::Reference,
|
||||||
HlMod::Static,
|
HlMod::Static,
|
||||||
|
@ -262,6 +263,7 @@ impl HlMod {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mask(self) -> u32 {
|
fn mask(self) -> u32 {
|
||||||
|
debug_assert!(Self::ALL.len() <= 32, "HlMod::mask is not enough to cover all variants");
|
||||||
1 << (self as u32)
|
1 << (self as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||||
<span class="bool_literal">true</span>
|
<span class="bool_literal">true</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span>
|
||||||
<span class="keyword const">const</span> <span class="constant const declaration">USAGE_OF_BOOL</span><span class="colon">:</span><span class="builtin_type">bool</span> <span class="operator">=</span> <span class="enum public">Bool</span><span class="operator">::</span><span class="enum_variant public">True</span><span class="operator">.</span><span class="method consuming public">to_primitive</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword const">const</span> <span class="constant const declaration">USAGE_OF_BOOL</span><span class="colon">:</span> <span class="builtin_type">bool</span> <span class="operator">=</span> <span class="enum public">Bool</span><span class="operator">::</span><span class="enum_variant public">True</span><span class="operator">.</span><span class="method consuming public">to_primitive</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
|
|
||||||
<span class="keyword">trait</span> <span class="trait declaration">Baz</span> <span class="brace">{</span>
|
<span class="keyword">trait</span> <span class="trait declaration">Baz</span> <span class="brace">{</span>
|
||||||
<span class="keyword">type</span> <span class="type_alias associated declaration static trait">Qux</span><span class="semicolon">;</span>
|
<span class="keyword">type</span> <span class="type_alias associated declaration static trait">Qux</span><span class="semicolon">;</span>
|
||||||
|
|
|
@ -300,7 +300,7 @@ impl Bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const USAGE_OF_BOOL:bool = Bool::True.to_primitive();
|
const USAGE_OF_BOOL: bool = Bool::True.to_primitive();
|
||||||
|
|
||||||
trait Baz {
|
trait Baz {
|
||||||
type Qux;
|
type Qux;
|
||||||
|
|
|
@ -17,15 +17,19 @@ macro_rules! define_semantic_token_types {
|
||||||
}
|
}
|
||||||
|
|
||||||
) => {
|
) => {
|
||||||
$(pub(crate) const $standard: SemanticTokenType = SemanticTokenType::$standard;)*
|
pub(crate) mod types {
|
||||||
$(pub(crate) const $custom: SemanticTokenType = SemanticTokenType::new($string);)*
|
use super::SemanticTokenType;
|
||||||
|
$(pub(crate) const $standard: SemanticTokenType = SemanticTokenType::$standard;)*
|
||||||
|
$(pub(crate) const $custom: SemanticTokenType = SemanticTokenType::new($string);)*
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
|
pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
|
||||||
$(SemanticTokenType::$standard,)*
|
$(SemanticTokenType::$standard,)*
|
||||||
$($custom),*
|
$(self::types::$custom),*
|
||||||
];
|
];
|
||||||
|
|
||||||
pub(crate) fn standard_fallback_type(token: SemanticTokenType) -> Option<SemanticTokenType> {
|
pub(crate) fn standard_fallback_type(token: SemanticTokenType) -> Option<SemanticTokenType> {
|
||||||
|
use self::types::*;
|
||||||
$(
|
$(
|
||||||
if token == $custom {
|
if token == $custom {
|
||||||
None $(.or(Some(SemanticTokenType::$fallback)))?
|
None $(.or(Some(SemanticTokenType::$fallback)))?
|
||||||
|
@ -61,39 +65,41 @@ define_semantic_token_types![
|
||||||
custom {
|
custom {
|
||||||
(ANGLE, "angle"),
|
(ANGLE, "angle"),
|
||||||
(ARITHMETIC, "arithmetic") => OPERATOR,
|
(ARITHMETIC, "arithmetic") => OPERATOR,
|
||||||
(ATTRIBUTE, "attribute") => DECORATOR,
|
|
||||||
(ATTRIBUTE_BRACKET, "attributeBracket") => DECORATOR,
|
(ATTRIBUTE_BRACKET, "attributeBracket") => DECORATOR,
|
||||||
|
(ATTRIBUTE, "attribute") => DECORATOR,
|
||||||
(BITWISE, "bitwise") => OPERATOR,
|
(BITWISE, "bitwise") => OPERATOR,
|
||||||
(BOOLEAN, "boolean"),
|
(BOOLEAN, "boolean"),
|
||||||
(BRACE, "brace"),
|
(BRACE, "brace"),
|
||||||
(BRACKET, "bracket"),
|
(BRACKET, "bracket"),
|
||||||
(BUILTIN_ATTRIBUTE, "builtinAttribute") => DECORATOR,
|
(BUILTIN_ATTRIBUTE, "builtinAttribute") => DECORATOR,
|
||||||
(BUILTIN_TYPE, "builtinType"),
|
(BUILTIN_TYPE, "builtinType") => TYPE,
|
||||||
(CHAR, "character") => STRING,
|
(CHAR, "character") => STRING,
|
||||||
(COLON, "colon"),
|
(COLON, "colon"),
|
||||||
(COMMA, "comma"),
|
(COMMA, "comma"),
|
||||||
(COMPARISON, "comparison") => OPERATOR,
|
(COMPARISON, "comparison") => OPERATOR,
|
||||||
(CONST_PARAMETER, "constParameter"),
|
(CONST_PARAMETER, "constParameter"),
|
||||||
(DERIVE, "derive") => DECORATOR,
|
(CONST, "const") => VARIABLE,
|
||||||
(DERIVE_HELPER, "deriveHelper") => DECORATOR,
|
(DERIVE_HELPER, "deriveHelper") => DECORATOR,
|
||||||
|
(DERIVE, "derive") => DECORATOR,
|
||||||
(DOT, "dot"),
|
(DOT, "dot"),
|
||||||
(ESCAPE_SEQUENCE, "escapeSequence") => STRING,
|
(ESCAPE_SEQUENCE, "escapeSequence") => STRING,
|
||||||
(INVALID_ESCAPE_SEQUENCE, "invalidEscapeSequence") => STRING,
|
|
||||||
(FORMAT_SPECIFIER, "formatSpecifier") => STRING,
|
(FORMAT_SPECIFIER, "formatSpecifier") => STRING,
|
||||||
(GENERIC, "generic") => TYPE_PARAMETER,
|
(GENERIC, "generic") => TYPE_PARAMETER,
|
||||||
|
(INVALID_ESCAPE_SEQUENCE, "invalidEscapeSequence") => STRING,
|
||||||
(LABEL, "label"),
|
(LABEL, "label"),
|
||||||
(LIFETIME, "lifetime"),
|
(LIFETIME, "lifetime"),
|
||||||
(LOGICAL, "logical") => OPERATOR,
|
(LOGICAL, "logical") => OPERATOR,
|
||||||
(MACRO_BANG, "macroBang") => MACRO,
|
(MACRO_BANG, "macroBang") => MACRO,
|
||||||
(PROC_MACRO, "procMacro") => MACRO,
|
|
||||||
(PARENTHESIS, "parenthesis"),
|
(PARENTHESIS, "parenthesis"),
|
||||||
|
(PROC_MACRO, "procMacro") => MACRO,
|
||||||
(PUNCTUATION, "punctuation"),
|
(PUNCTUATION, "punctuation"),
|
||||||
(SELF_KEYWORD, "selfKeyword") => KEYWORD,
|
(SELF_KEYWORD, "selfKeyword") => KEYWORD,
|
||||||
(SELF_TYPE_KEYWORD, "selfTypeKeyword") => KEYWORD,
|
(SELF_TYPE_KEYWORD, "selfTypeKeyword") => KEYWORD,
|
||||||
(SEMICOLON, "semicolon"),
|
(SEMICOLON, "semicolon"),
|
||||||
(TYPE_ALIAS, "typeAlias"),
|
(STATIC, "static") => VARIABLE,
|
||||||
(TOOL_MODULE, "toolModule") => DECORATOR,
|
(TOOL_MODULE, "toolModule") => DECORATOR,
|
||||||
(UNION, "union"),
|
(TYPE_ALIAS, "typeAlias") => TYPE,
|
||||||
|
(UNION, "union") => TYPE,
|
||||||
(UNRESOLVED_REFERENCE, "unresolvedReference"),
|
(UNRESOLVED_REFERENCE, "unresolvedReference"),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -112,13 +118,16 @@ macro_rules! define_semantic_token_modifiers {
|
||||||
}
|
}
|
||||||
|
|
||||||
) => {
|
) => {
|
||||||
|
pub(crate) mod modifiers {
|
||||||
|
use super::SemanticTokenModifier;
|
||||||
|
|
||||||
$(pub(crate) const $standard: SemanticTokenModifier = SemanticTokenModifier::$standard;)*
|
$(pub(crate) const $standard: SemanticTokenModifier = SemanticTokenModifier::$standard;)*
|
||||||
$(pub(crate) const $custom: SemanticTokenModifier = SemanticTokenModifier::new($string);)*
|
$(pub(crate) const $custom: SemanticTokenModifier = SemanticTokenModifier::new($string);)*
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
|
pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
|
||||||
$(SemanticTokenModifier::$standard,)*
|
$(SemanticTokenModifier::$standard,)*
|
||||||
$($custom),*
|
$(self::modifiers::$custom),*
|
||||||
];
|
];
|
||||||
|
|
||||||
const LAST_STANDARD_MOD: usize = count_tts!($($standard)*);
|
const LAST_STANDARD_MOD: usize = count_tts!($($standard)*);
|
||||||
|
@ -145,8 +154,8 @@ define_semantic_token_modifiers![
|
||||||
(INTRA_DOC_LINK, "intraDocLink"),
|
(INTRA_DOC_LINK, "intraDocLink"),
|
||||||
(LIBRARY, "library"),
|
(LIBRARY, "library"),
|
||||||
(MACRO_MODIFIER, "macro"),
|
(MACRO_MODIFIER, "macro"),
|
||||||
(PROC_MACRO_MODIFIER, "proc_macro"),
|
|
||||||
(MUTABLE, "mutable"),
|
(MUTABLE, "mutable"),
|
||||||
|
(PROC_MACRO_MODIFIER, "procMacro"),
|
||||||
(PUBLIC, "public"),
|
(PUBLIC, "public"),
|
||||||
(REFERENCE, "reference"),
|
(REFERENCE, "reference"),
|
||||||
(TRAIT_MODIFIER, "trait"),
|
(TRAIT_MODIFIER, "trait"),
|
||||||
|
|
|
@ -654,97 +654,99 @@ pub(crate) fn semantic_token_delta(
|
||||||
fn semantic_token_type_and_modifiers(
|
fn semantic_token_type_and_modifiers(
|
||||||
highlight: Highlight,
|
highlight: Highlight,
|
||||||
) -> (lsp_types::SemanticTokenType, semantic_tokens::ModifierSet) {
|
) -> (lsp_types::SemanticTokenType, semantic_tokens::ModifierSet) {
|
||||||
|
use semantic_tokens::{modifiers as mods, types};
|
||||||
|
|
||||||
let ty = match highlight.tag {
|
let ty = match highlight.tag {
|
||||||
HlTag::Symbol(symbol) => match symbol {
|
HlTag::Symbol(symbol) => match symbol {
|
||||||
SymbolKind::Attribute => semantic_tokens::DECORATOR,
|
SymbolKind::Attribute => types::DECORATOR,
|
||||||
SymbolKind::Derive => semantic_tokens::DERIVE,
|
SymbolKind::Derive => types::DERIVE,
|
||||||
SymbolKind::DeriveHelper => semantic_tokens::DERIVE_HELPER,
|
SymbolKind::DeriveHelper => types::DERIVE_HELPER,
|
||||||
SymbolKind::Module => semantic_tokens::NAMESPACE,
|
SymbolKind::Module => types::NAMESPACE,
|
||||||
SymbolKind::Impl => semantic_tokens::TYPE_ALIAS,
|
SymbolKind::Impl => types::TYPE_ALIAS,
|
||||||
SymbolKind::Field => semantic_tokens::PROPERTY,
|
SymbolKind::Field => types::PROPERTY,
|
||||||
SymbolKind::TypeParam => semantic_tokens::TYPE_PARAMETER,
|
SymbolKind::TypeParam => types::TYPE_PARAMETER,
|
||||||
SymbolKind::ConstParam => semantic_tokens::CONST_PARAMETER,
|
SymbolKind::ConstParam => types::CONST_PARAMETER,
|
||||||
SymbolKind::LifetimeParam => semantic_tokens::LIFETIME,
|
SymbolKind::LifetimeParam => types::LIFETIME,
|
||||||
SymbolKind::Label => semantic_tokens::LABEL,
|
SymbolKind::Label => types::LABEL,
|
||||||
SymbolKind::ValueParam => semantic_tokens::PARAMETER,
|
SymbolKind::ValueParam => types::PARAMETER,
|
||||||
SymbolKind::SelfParam => semantic_tokens::SELF_KEYWORD,
|
SymbolKind::SelfParam => types::SELF_KEYWORD,
|
||||||
SymbolKind::SelfType => semantic_tokens::SELF_TYPE_KEYWORD,
|
SymbolKind::SelfType => types::SELF_TYPE_KEYWORD,
|
||||||
SymbolKind::Local => semantic_tokens::VARIABLE,
|
SymbolKind::Local => types::VARIABLE,
|
||||||
SymbolKind::Method => semantic_tokens::METHOD,
|
SymbolKind::Method => types::METHOD,
|
||||||
SymbolKind::Function => semantic_tokens::FUNCTION,
|
SymbolKind::Function => types::FUNCTION,
|
||||||
SymbolKind::Const => semantic_tokens::VARIABLE,
|
SymbolKind::Const => types::CONST,
|
||||||
SymbolKind::Static => semantic_tokens::VARIABLE,
|
SymbolKind::Static => types::STATIC,
|
||||||
SymbolKind::Struct => semantic_tokens::STRUCT,
|
SymbolKind::Struct => types::STRUCT,
|
||||||
SymbolKind::Enum => semantic_tokens::ENUM,
|
SymbolKind::Enum => types::ENUM,
|
||||||
SymbolKind::Variant => semantic_tokens::ENUM_MEMBER,
|
SymbolKind::Variant => types::ENUM_MEMBER,
|
||||||
SymbolKind::Union => semantic_tokens::UNION,
|
SymbolKind::Union => types::UNION,
|
||||||
SymbolKind::TypeAlias => semantic_tokens::TYPE_ALIAS,
|
SymbolKind::TypeAlias => types::TYPE_ALIAS,
|
||||||
SymbolKind::Trait => semantic_tokens::INTERFACE,
|
SymbolKind::Trait => types::INTERFACE,
|
||||||
SymbolKind::TraitAlias => semantic_tokens::INTERFACE,
|
SymbolKind::TraitAlias => types::INTERFACE,
|
||||||
SymbolKind::Macro => semantic_tokens::MACRO,
|
SymbolKind::Macro => types::MACRO,
|
||||||
SymbolKind::ProcMacro => semantic_tokens::PROC_MACRO,
|
SymbolKind::ProcMacro => types::PROC_MACRO,
|
||||||
SymbolKind::BuiltinAttr => semantic_tokens::BUILTIN_ATTRIBUTE,
|
SymbolKind::BuiltinAttr => types::BUILTIN_ATTRIBUTE,
|
||||||
SymbolKind::ToolModule => semantic_tokens::TOOL_MODULE,
|
SymbolKind::ToolModule => types::TOOL_MODULE,
|
||||||
},
|
},
|
||||||
HlTag::AttributeBracket => semantic_tokens::ATTRIBUTE_BRACKET,
|
HlTag::AttributeBracket => types::ATTRIBUTE_BRACKET,
|
||||||
HlTag::BoolLiteral => semantic_tokens::BOOLEAN,
|
HlTag::BoolLiteral => types::BOOLEAN,
|
||||||
HlTag::BuiltinType => semantic_tokens::BUILTIN_TYPE,
|
HlTag::BuiltinType => types::BUILTIN_TYPE,
|
||||||
HlTag::ByteLiteral | HlTag::NumericLiteral => semantic_tokens::NUMBER,
|
HlTag::ByteLiteral | HlTag::NumericLiteral => types::NUMBER,
|
||||||
HlTag::CharLiteral => semantic_tokens::CHAR,
|
HlTag::CharLiteral => types::CHAR,
|
||||||
HlTag::Comment => semantic_tokens::COMMENT,
|
HlTag::Comment => types::COMMENT,
|
||||||
HlTag::EscapeSequence => semantic_tokens::ESCAPE_SEQUENCE,
|
HlTag::EscapeSequence => types::ESCAPE_SEQUENCE,
|
||||||
HlTag::InvalidEscapeSequence => semantic_tokens::INVALID_ESCAPE_SEQUENCE,
|
HlTag::InvalidEscapeSequence => types::INVALID_ESCAPE_SEQUENCE,
|
||||||
HlTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER,
|
HlTag::FormatSpecifier => types::FORMAT_SPECIFIER,
|
||||||
HlTag::Keyword => semantic_tokens::KEYWORD,
|
HlTag::Keyword => types::KEYWORD,
|
||||||
HlTag::None => semantic_tokens::GENERIC,
|
HlTag::None => types::GENERIC,
|
||||||
HlTag::Operator(op) => match op {
|
HlTag::Operator(op) => match op {
|
||||||
HlOperator::Bitwise => semantic_tokens::BITWISE,
|
HlOperator::Bitwise => types::BITWISE,
|
||||||
HlOperator::Arithmetic => semantic_tokens::ARITHMETIC,
|
HlOperator::Arithmetic => types::ARITHMETIC,
|
||||||
HlOperator::Logical => semantic_tokens::LOGICAL,
|
HlOperator::Logical => types::LOGICAL,
|
||||||
HlOperator::Comparison => semantic_tokens::COMPARISON,
|
HlOperator::Comparison => types::COMPARISON,
|
||||||
HlOperator::Other => semantic_tokens::OPERATOR,
|
HlOperator::Other => types::OPERATOR,
|
||||||
},
|
},
|
||||||
HlTag::StringLiteral => semantic_tokens::STRING,
|
HlTag::StringLiteral => types::STRING,
|
||||||
HlTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE,
|
HlTag::UnresolvedReference => types::UNRESOLVED_REFERENCE,
|
||||||
HlTag::Punctuation(punct) => match punct {
|
HlTag::Punctuation(punct) => match punct {
|
||||||
HlPunct::Bracket => semantic_tokens::BRACKET,
|
HlPunct::Bracket => types::BRACKET,
|
||||||
HlPunct::Brace => semantic_tokens::BRACE,
|
HlPunct::Brace => types::BRACE,
|
||||||
HlPunct::Parenthesis => semantic_tokens::PARENTHESIS,
|
HlPunct::Parenthesis => types::PARENTHESIS,
|
||||||
HlPunct::Angle => semantic_tokens::ANGLE,
|
HlPunct::Angle => types::ANGLE,
|
||||||
HlPunct::Comma => semantic_tokens::COMMA,
|
HlPunct::Comma => types::COMMA,
|
||||||
HlPunct::Dot => semantic_tokens::DOT,
|
HlPunct::Dot => types::DOT,
|
||||||
HlPunct::Colon => semantic_tokens::COLON,
|
HlPunct::Colon => types::COLON,
|
||||||
HlPunct::Semi => semantic_tokens::SEMICOLON,
|
HlPunct::Semi => types::SEMICOLON,
|
||||||
HlPunct::Other => semantic_tokens::PUNCTUATION,
|
HlPunct::Other => types::PUNCTUATION,
|
||||||
HlPunct::MacroBang => semantic_tokens::MACRO_BANG,
|
HlPunct::MacroBang => types::MACRO_BANG,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut mods = semantic_tokens::ModifierSet::default();
|
let mut mods = semantic_tokens::ModifierSet::default();
|
||||||
for modifier in highlight.mods.iter() {
|
for modifier in highlight.mods.iter() {
|
||||||
let modifier = match modifier {
|
let modifier = match modifier {
|
||||||
HlMod::Associated => semantic_tokens::ASSOCIATED,
|
HlMod::Associated => mods::ASSOCIATED,
|
||||||
HlMod::Async => semantic_tokens::ASYNC,
|
HlMod::Async => mods::ASYNC,
|
||||||
HlMod::Attribute => semantic_tokens::ATTRIBUTE_MODIFIER,
|
HlMod::Attribute => mods::ATTRIBUTE_MODIFIER,
|
||||||
HlMod::Callable => semantic_tokens::CALLABLE,
|
HlMod::Callable => mods::CALLABLE,
|
||||||
HlMod::Const => semantic_tokens::CONSTANT,
|
HlMod::Const => mods::CONSTANT,
|
||||||
HlMod::Consuming => semantic_tokens::CONSUMING,
|
HlMod::Consuming => mods::CONSUMING,
|
||||||
HlMod::ControlFlow => semantic_tokens::CONTROL_FLOW,
|
HlMod::ControlFlow => mods::CONTROL_FLOW,
|
||||||
HlMod::CrateRoot => semantic_tokens::CRATE_ROOT,
|
HlMod::CrateRoot => mods::CRATE_ROOT,
|
||||||
HlMod::DefaultLibrary => semantic_tokens::DEFAULT_LIBRARY,
|
HlMod::DefaultLibrary => mods::DEFAULT_LIBRARY,
|
||||||
HlMod::Definition => semantic_tokens::DECLARATION,
|
HlMod::Definition => mods::DECLARATION,
|
||||||
HlMod::Documentation => semantic_tokens::DOCUMENTATION,
|
HlMod::Documentation => mods::DOCUMENTATION,
|
||||||
HlMod::Injected => semantic_tokens::INJECTED,
|
HlMod::Injected => mods::INJECTED,
|
||||||
HlMod::IntraDocLink => semantic_tokens::INTRA_DOC_LINK,
|
HlMod::IntraDocLink => mods::INTRA_DOC_LINK,
|
||||||
HlMod::Library => semantic_tokens::LIBRARY,
|
HlMod::Library => mods::LIBRARY,
|
||||||
HlMod::Macro => semantic_tokens::MACRO_MODIFIER,
|
HlMod::Macro => mods::MACRO_MODIFIER,
|
||||||
HlMod::ProcMacro => semantic_tokens::PROC_MACRO_MODIFIER,
|
HlMod::ProcMacro => mods::PROC_MACRO_MODIFIER,
|
||||||
HlMod::Mutable => semantic_tokens::MUTABLE,
|
HlMod::Mutable => mods::MUTABLE,
|
||||||
HlMod::Public => semantic_tokens::PUBLIC,
|
HlMod::Public => mods::PUBLIC,
|
||||||
HlMod::Reference => semantic_tokens::REFERENCE,
|
HlMod::Reference => mods::REFERENCE,
|
||||||
HlMod::Static => semantic_tokens::STATIC,
|
HlMod::Static => mods::STATIC,
|
||||||
HlMod::Trait => semantic_tokens::TRAIT_MODIFIER,
|
HlMod::Trait => mods::TRAIT_MODIFIER,
|
||||||
HlMod::Unsafe => semantic_tokens::UNSAFE,
|
HlMod::Unsafe => mods::UNSAFE,
|
||||||
};
|
};
|
||||||
mods |= modifier;
|
mods |= modifier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1934,6 +1934,11 @@
|
||||||
"id": "constParameter",
|
"id": "constParameter",
|
||||||
"description": "Style for const generics"
|
"description": "Style for const generics"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "const",
|
||||||
|
"description": "Style for consts",
|
||||||
|
"superType": "variable"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "derive",
|
"id": "derive",
|
||||||
"description": "Style for derives",
|
"description": "Style for derives",
|
||||||
|
@ -1979,20 +1984,25 @@
|
||||||
"description": "Style for the ! token of macro calls",
|
"description": "Style for the ! token of macro calls",
|
||||||
"superType": "punctuation"
|
"superType": "punctuation"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "operator",
|
|
||||||
"description": "Style for operators",
|
|
||||||
"superType": "punctuation"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "parenthesis",
|
"id": "parenthesis",
|
||||||
"description": "Style for ( or )",
|
"description": "Style for ( or )",
|
||||||
"superType": "punctuation"
|
"superType": "punctuation"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "procMacro",
|
||||||
|
"description": "Style for proc macro code",
|
||||||
|
"superType": "macro"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "punctuation",
|
"id": "punctuation",
|
||||||
"description": "Style for generic punctuation"
|
"description": "Style for generic punctuation"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "operator",
|
||||||
|
"description": "Style for operators",
|
||||||
|
"superType": "punctuation"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "selfKeyword",
|
"id": "selfKeyword",
|
||||||
"description": "Style for the self keyword",
|
"description": "Style for the self keyword",
|
||||||
|
@ -2008,6 +2018,16 @@
|
||||||
"description": "Style for ;",
|
"description": "Style for ;",
|
||||||
"superType": "punctuation"
|
"superType": "punctuation"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "static",
|
||||||
|
"description": "Style for statics",
|
||||||
|
"superType": "variable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "toolModule",
|
||||||
|
"description": "Style for tool module attributes",
|
||||||
|
"superType": "decorator"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "typeAlias",
|
"id": "typeAlias",
|
||||||
"description": "Style for type aliases",
|
"description": "Style for type aliases",
|
||||||
|
@ -2064,10 +2084,18 @@
|
||||||
"id": "library",
|
"id": "library",
|
||||||
"description": "Style for items that are defined outside of the current crate"
|
"description": "Style for items that are defined outside of the current crate"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "macro",
|
||||||
|
"description": "Style for tokens inside of macro calls"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "mutable",
|
"id": "mutable",
|
||||||
"description": "Style for mutable locals and statics as well as functions taking `&mut self`"
|
"description": "Style for mutable locals and statics as well as functions taking `&mut self`"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "procMacro",
|
||||||
|
"description": "Style for tokens inside of proc-macro calls"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "public",
|
"id": "public",
|
||||||
"description": "Style for items that are from the current crate and are `pub`"
|
"description": "Style for items that are from the current crate and are `pub`"
|
||||||
|
|
Loading…
Reference in a new issue