-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Format string literal syntax highlighting is broken for escapes and interpolations simultaneously #4138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Where does the highlighting for the escape string come from? It is not implemented in https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/syntax_highlighting.rs where the logic for the format specifier is implemented. |
4925: Syntax highlighting for escape sequences in strings r=matklad a=ltentrup I have added a new semantic token type `ESCAPE_SEQUENCE` as the LSP specification does not seem to have an appropriate token type. This may actually be a regression for some users, as the TextMate Rust grammar has a scope `constant.character.escape.rust` which highlights escape sequences (which caused problems with semantic highlighting, see #4138). Fixes #2604. Co-authored-by: Leander Tentrup <[email protected]>
Does this issue persist in the latest nightly? There is now support for highlighting escape sequences (although it has to be enabled manually) |
@ltentrup yes, it works as expected for me now, thank you! I didn't have to enable anything specific, it seemed to activate alongside the rest of semantic syntax highlighting. Is that expected? |
No, I did not expect escape sequences to be highlighted as we introduced a custom/non-standard semantic token |
Sounds like this was resolved, please shout if there's still something to do here. |
Uh oh!
There was an error while loading. Please reload this page.
cc #4006, @ltentrup
As you can see, the string is bold starting from the escape sequence up until the first placeholder symbol.
This happens only inside of format strings as far as I can tell

The text was updated successfully, but these errors were encountered: