aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-06 00:25:23 +0000
committerGitHub <[email protected]>2021-02-06 00:25:23 +0000
commitd7c99931d05e3723d878bea5dc26766791fa4e69 (patch)
tree4507ec2bc139c08b6d03ad0a774c1a64502299d0
parent582a202d6ead6d2b793923c8f63801d34c72a448 (diff)
parentf4e3eceb6f9c708cb94ee5e2940c6ad4f3abc629 (diff)
Merge #7578
7578: Add a semantic token type for char literals r=Veykril a=petr-tik Fixes #7530 The LSP spec doesn't recognise character literals, so had to extend the suported types to our own custom type Co-authored-by: petr-tik <[email protected]>
-rw-r--r--crates/rust-analyzer/src/semantic_tokens.rs1
-rw-r--r--crates/rust-analyzer/src/to_proto.rs3
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,