Closed Qix- closed 4 months ago
rust-analyzer
does set the colorizedBracketPairs
language configuration but I am not aware of any way to tell VSCode in what contexts not to consider these unfortunately
FWIW it appears all character constants are being parsed incorrectly here, regardless of them being {
or }
.
As in their color is incorrect? Can you put the cursor on one of those incorrect lit characters, run the Inspect Editor Tokens and Scopes
command and paste the output?
All taken from https://github.com/oro-os/qdb/blob/9496bd17903f23a64ef077e07124a72eff6bcdae/src/gdb.rs:
Incorrect:
Correct:
Incorrect:
Incorrect:
Incorrect:
Ah, do you have semantic highlighting disabled? Then this is a VSCode issue, rust-analyzer does not ship with a textmate grammar so this is likely a bug with vscode's textmate grammar
I don't think I've explicitly disabled it but yeah it appears to be an issue with the textmate grammar. I'll open an issue over there, then :)
Thanks for investigating either way!
rust-analyzer version: rust-analyzer version: 0.3.2037-standalone
rustc version: rustc 1.80.0-nightly (804421dff 2024-06-07)
editor or extension: VSCode 1.91.1
relevant settings: Nothing unusual.
repository link (if public, optional): N/A
code snippet to reproduce:
This is valid rust that breaks syntax highlighting.
The constant can either be
b'}'
, which results in this incorrect highlighting (final}
is red, indicating error):or
b'{'
(initial{
is red):Further, the constant itself is highlighted as though it is part of the syntax and not part of a character constant.
In the simple example it's a bit innocuous but in the larger codebase I initially found this in it started to really get confusing as small, subtle highlighting issues started to cascade through the bits under the constant.