rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Highlighter doesn't understand escaped brackets in format!(r##)

Open 2ndDerivative opened this issue 7 months ago • 0 comments

rust-analyzer version: 0.3.2500-standalone (a207299344 2025-06-15)

rustc version: 1.87

editor or extension: VSCode

code snippet to reproduce:

const HERE: &str = "this is a string literal"

fn foo() -> String {
    format!(r#"The brackets \{HERE} are load-bearing"#)
}

Hi! In the example above, my rust-analyzer will "brown out" the {HERE} part even though the \ does not escape the bracket when r## is used.

2ndDerivative avatar Jun 18 '25 09:06 2ndDerivative