Skip to content

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

Open
@2ndDerivative

Description

@2ndDerivative

rust-analyzer version: 0.3.2500-standalone (a207299 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-highlighting(semantic) token highlightingC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions