microsoft / microsoft/monaco-editor

Rust syntax highlighting broken for raw strings

Open
#2,897 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug grammars help wanted
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Seems like this is still a problem for code such as:

fn main() {
    let a = r#"hello" world"#;
    println!("{}", a);
}

Using the #ed raw strings.
Now that the rust-playground may also use monaco one may encounter this problem:

image

Note: rust's raw strings are formed as an r, then some number of #s, "<the string here>", then a matching number of #s

Originally posted by @Ben-Lichtman in https://github.com/microsoft/monaco-editor/issues/2552#issuecomment-1013553336

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in the Monaco editor or rust-playground and inspect the Rust syntax-highlighting support. Verify that raw strings with one or more matching # delimiters are highlighted as a single string, including the shown example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.