Skip to content

Commit 86d5e29

Browse files
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.
1 parent ad0aea4 commit 86d5e29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ macro_rules! define_semantic_token_types {
2424
}
2525

2626
pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
27-
$(SemanticTokenType::$standard,)*
27+
$(self::types::$standard,)*
2828
$(self::types::$custom),*
2929
];
3030

3131
pub(crate) fn standard_fallback_type(token: SemanticTokenType) -> Option<SemanticTokenType> {
3232
use self::types::*;
3333
$(
3434
if token == $custom {
35-
None $(.or(Some(SemanticTokenType::$fallback)))?
35+
None $(.or(Some(self::types::$fallback)))?
3636
} else
3737
)*
3838
{ Some(token )}
@@ -60,6 +60,7 @@ define_semantic_token_types![
6060
STRUCT,
6161
TYPE_PARAMETER,
6262
VARIABLE,
63+
TYPE,
6364
}
6465

6566
custom {

0 commit comments

Comments
 (0)