diff options
author | petr-tik <[email protected]> | 2021-02-05 23:46:39 +0000 |
---|---|---|
committer | petr-tik <[email protected]> | 2021-02-05 23:46:39 +0000 |
commit | f4e3eceb6f9c708cb94ee5e2940c6ad4f3abc629 (patch) | |
tree | 4507ec2bc139c08b6d03ad0a774c1a64502299d0 | |
parent | 582a202d6ead6d2b793923c8f63801d34c72a448 (diff) |
Add a semantic token type for char literals
The LSP spec doesn't recognise character literals, so
had to extend the suported types to our own custom type
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index 7ce9a4ab6..be0bea00b 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -44,6 +44,7 @@ define_semantic_token_types![ | |||
44 | (BRACE, "brace"), | 44 | (BRACE, "brace"), |
45 | (BRACKET, "bracket"), | 45 | (BRACKET, "bracket"), |
46 | (BUILTIN_TYPE, "builtinType"), | 46 | (BUILTIN_TYPE, "builtinType"), |
47 | (CHAR_LITERAL, "characterLiteral"), | ||
47 | (COMMA, "comma"), | 48 | (COMMA, "comma"), |
48 | (COLON, "colon"), | 49 | (COLON, "colon"), |
49 | (DOT, "dot"), | 50 | (DOT, "dot"), |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 96f915f1c..5236932e8 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -426,7 +426,8 @@ fn semantic_token_type_and_modifiers( | |||
426 | HlTag::None => semantic_tokens::GENERIC, | 426 | HlTag::None => semantic_tokens::GENERIC, |
427 | HlTag::ByteLiteral | HlTag::NumericLiteral => lsp_types::SemanticTokenType::NUMBER, | 427 | HlTag::ByteLiteral | HlTag::NumericLiteral => lsp_types::SemanticTokenType::NUMBER, |
428 | HlTag::BoolLiteral => semantic_tokens::BOOLEAN, | 428 | HlTag::BoolLiteral => semantic_tokens::BOOLEAN, |
429 | HlTag::CharLiteral | HlTag::StringLiteral => lsp_types::SemanticTokenType::STRING, | 429 | HlTag::StringLiteral => lsp_types::SemanticTokenType::STRING, |
430 | HlTag::CharLiteral => semantic_tokens::CHAR_LITERAL, | ||
430 | HlTag::Comment => lsp_types::SemanticTokenType::COMMENT, | 431 | HlTag::Comment => lsp_types::SemanticTokenType::COMMENT, |
431 | HlTag::Attribute => semantic_tokens::ATTRIBUTE, | 432 | HlTag::Attribute => semantic_tokens::ATTRIBUTE, |
432 | HlTag::Keyword => lsp_types::SemanticTokenType::KEYWORD, | 433 | HlTag::Keyword => lsp_types::SemanticTokenType::KEYWORD, |