Remove syntax highlighting hack for builtin attrs

This commit is contained in:
Lukas Wirth 2021-12-03 16:53:30 +01:00
parent e58af219a4
commit d1677f3286
13 changed files with 62 additions and 83 deletions

View file

@ -65,6 +65,7 @@ define_semantic_token_types![
(SELF_KEYWORD, "selfKeyword"),
(SEMICOLON, "semicolon"),
(TYPE_ALIAS, "typeAlias"),
(TOOL, "tool"),
(UNION, "union"),
(UNRESOLVED_REFERENCE, "unresolvedReference"),
];

View file

@ -50,8 +50,8 @@ pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind {
SymbolKind::Enum => lsp_types::SymbolKind::ENUM,
SymbolKind::Variant => lsp_types::SymbolKind::ENUM_MEMBER,
SymbolKind::Trait => lsp_types::SymbolKind::INTERFACE,
SymbolKind::Macro => lsp_types::SymbolKind::FUNCTION,
SymbolKind::Module => lsp_types::SymbolKind::MODULE,
SymbolKind::Macro | SymbolKind::BuiltinAttr => lsp_types::SymbolKind::FUNCTION,
SymbolKind::Module | SymbolKind::Tool => lsp_types::SymbolKind::MODULE,
SymbolKind::TypeAlias | SymbolKind::TypeParam => lsp_types::SymbolKind::TYPE_PARAMETER,
SymbolKind::Field => lsp_types::SymbolKind::FIELD,
SymbolKind::Static => lsp_types::SymbolKind::CONSTANT,
@ -128,6 +128,8 @@ pub(crate) fn completion_item_kind(
SymbolKind::Union => lsp_types::CompletionItemKind::STRUCT,
SymbolKind::ValueParam => lsp_types::CompletionItemKind::VALUE,
SymbolKind::Variant => lsp_types::CompletionItemKind::ENUM_MEMBER,
SymbolKind::BuiltinAttr => lsp_types::CompletionItemKind::FUNCTION,
SymbolKind::Tool => lsp_types::CompletionItemKind::MODULE,
},
}
}
@ -499,10 +501,11 @@ fn semantic_token_type_and_modifiers(
SymbolKind::TypeAlias => semantic_tokens::TYPE_ALIAS,
SymbolKind::Trait => lsp_types::SemanticTokenType::INTERFACE,
SymbolKind::Macro => lsp_types::SemanticTokenType::MACRO,
SymbolKind::BuiltinAttr => semantic_tokens::BUILTIN_ATTRIBUTE,
SymbolKind::Tool => semantic_tokens::TOOL,
},
HlTag::Attribute => semantic_tokens::ATTRIBUTE,
HlTag::BoolLiteral => semantic_tokens::BOOLEAN,
HlTag::BuiltinAttr => semantic_tokens::BUILTIN_ATTRIBUTE,
HlTag::BuiltinType => semantic_tokens::BUILTIN_TYPE,
HlTag::ByteLiteral | HlTag::NumericLiteral => lsp_types::SemanticTokenType::NUMBER,
HlTag::CharLiteral => semantic_tokens::CHAR,