Use lsp-types DECORATOR token type

This commit is contained in:
Lukas Wirth
2022-08-23 14:00:29 +02:00
parent 31fb917d8d
commit 2a26b054b7
4 changed files with 20 additions and 22 deletions

View File

@@ -12,26 +12,26 @@ macro_rules! define_semantic_token_types {
$(pub(crate) const $ident: SemanticTokenType = SemanticTokenType::new($string);)*
pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
SemanticTokenType::COMMENT,
SemanticTokenType::KEYWORD,
SemanticTokenType::STRING,
SemanticTokenType::NUMBER,
SemanticTokenType::REGEXP,
SemanticTokenType::OPERATOR,
SemanticTokenType::NAMESPACE,
SemanticTokenType::TYPE,
SemanticTokenType::STRUCT,
SemanticTokenType::CLASS,
SemanticTokenType::INTERFACE,
SemanticTokenType::ENUM,
SemanticTokenType::COMMENT,
SemanticTokenType::ENUM_MEMBER,
SemanticTokenType::TYPE_PARAMETER,
SemanticTokenType::ENUM,
SemanticTokenType::FUNCTION,
SemanticTokenType::METHOD,
SemanticTokenType::PROPERTY,
SemanticTokenType::INTERFACE,
SemanticTokenType::KEYWORD,
SemanticTokenType::MACRO,
SemanticTokenType::VARIABLE,
SemanticTokenType::METHOD,
SemanticTokenType::NAMESPACE,
SemanticTokenType::NUMBER,
SemanticTokenType::OPERATOR,
SemanticTokenType::PARAMETER,
SemanticTokenType::PROPERTY,
SemanticTokenType::REGEXP,
SemanticTokenType::STRING,
SemanticTokenType::STRUCT,
SemanticTokenType::TYPE_PARAMETER,
SemanticTokenType::TYPE,
SemanticTokenType::VARIABLE,
$($ident),*
];
};
@@ -52,8 +52,6 @@ define_semantic_token_types![
(COMMA, "comma"),
(COMPARISON, "comparison"),
(CONST_PARAMETER, "constParameter"),
// FIXME: to be replaced once lsp-types has the upstream version
(DECORATOR, "decorator"),
(DERIVE, "derive"),
(DERIVE_HELPER, "deriveHelper"),
(DOT, "dot"),

View File

@@ -558,7 +558,7 @@ fn semantic_token_type_and_modifiers(
let mut mods = semantic_tokens::ModifierSet::default();
let type_ = match highlight.tag {
HlTag::Symbol(symbol) => match symbol {
SymbolKind::Attribute => semantic_tokens::DECORATOR,
SymbolKind::Attribute => lsp_types::SemanticTokenType::DECORATOR,
SymbolKind::Derive => semantic_tokens::DERIVE,
SymbolKind::DeriveHelper => semantic_tokens::DERIVE_HELPER,
SymbolKind::Module => lsp_types::SemanticTokenType::NAMESPACE,