Skip to content

Commit d121307

Browse files
committed
Auto merge of #12220 - arzg:fix-character-semantic-token, r=arzg
Fix `character` semantic token type definition The semantic token type for character literals is called `character`: https://github.com/rust-lang/rust-analyzer/blob/94fa8a6534cf93276ad7e205026402f24d41a0b2/crates/rust-analyzer/src/semantic_tokens.rs#L51 and yet the definition in `package.json` uses `char`. In practice this means trying to highlight `char` doesn’t have any effect, while `character` doesn’t have any hover documentation and doesn’t appear in autocomplete. The definition also defines the fallback semantic token type as `type`; luckily since it currently references the non-existent `char` this doesn’t have any effect, since it doesn’t really make sense to highlight character literals as types. This PR fixes the definition in `package.json` to correctly reference `character`, and also defines the fallback type as `number`. I’d say character literals are closer to a shorthand for writing a number than a string, though this is debatable and I’d be happy to change it to `string`, or anything else.
2 parents 94fa8a6 + 23ec7cf commit d121307

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

editors/code/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1216,9 +1216,9 @@
12161216
"superType": "type"
12171217
},
12181218
{
1219-
"id": "char",
1219+
"id": "character",
12201220
"description": "Style for character literals",
1221-
"superType": "type"
1221+
"superType": "string"
12221222
},
12231223
{
12241224
"id": "colon",

0 commit comments

Comments
 (0)