diff options
| author | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-01-27 15:08:00 +0200 |
|---|---|---|
| committer | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-01-27 15:08:00 +0200 |
| commit | 86d5e295d6fb7ad2c738198a5de08d03bfe7470a (patch) | |
| tree | 2fef15d11c15fd33ec6fb2a0746fc2eaed1b3fc0 | |
| parent | ad0aea432356b5687684a370d4c309989de1a549 (diff) | |
| download | rust-86d5e295d6fb7ad2c738198a5de08d03bfe7470a.tar.gz rust-86d5e295d6fb7ad2c738198a5de08d03bfe7470a.zip | |
Fix a missing standard token in semantic highlighting
That was used as a fallback, causing a panic when the fallback was chosen. I also made sure this won't happen again by guaranteeing in the macro generating the tokens that they all exist.
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs index 991c10743f7..3c21e199252 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs @@ -24,7 +24,7 @@ macro_rules! define_semantic_token_types { } pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[ - $(SemanticTokenType::$standard,)* + $(self::types::$standard,)* $(self::types::$custom),* ]; @@ -32,7 +32,7 @@ macro_rules! define_semantic_token_types { use self::types::*; $( if token == $custom { - None $(.or(Some(SemanticTokenType::$fallback)))? + None $(.or(Some(self::types::$fallback)))? } else )* { Some(token )} @@ -60,6 +60,7 @@ define_semantic_token_types