Skip to content

String parsing broken in Nova 6 #5

@logancollins

Description

@logancollins

Hello! We recently released Nova 6, and have received reports that doing so has caused the Rust extension to break its syntax highlighting. After some investigation, I found that this was due to a change in our parser we made to fix a bug.

It seems that Rust strings which contain an escape sequence for the closing quotes is not being properly parsed, which leads to the string ending early and a new string being started. One user provided this minimal code example:

my_string = String::from("an escaped quote mark\"")
println!("{}", my_string);

Unfortunately, the bug in Nova's parser present in Nova 5.1 and before meant that this inner quote was was accidentally skipped by parsing entirely, so the escape "handled correct" accidentally as well.

You should be able to resolve the issue in the Rust extension by explicitly parsing this escape sequences, which will ensure the parser does not end the string early:

<scope name="rust.string">
    <starts-with>
        <expression>&quot;</expression>
    </starts-with>
    <ends-with>
        <expression>&quot;</expression>
    </ends-with>
    <subscopes>
        <scope name="rust.string.escape">
            <expression>\\(?:\\|&quot;)</expression>
        </scope>
    </subscopes>
</scope>

If you need any more information, please don't hesitate to let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions