microsoft / microsoft/monaco-editor

[Bug] Rust raw strings with `br` or `cr` prefix are not treated as raw strings

Open
#4,856 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

monaco editor playground

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `fn main() {
    let a = r#"abc\\"#;
    let b = br"abc\\";
    let c = cr"abc\\";
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "rust",
	automaticLayout: true,
});
Reproduction Steps

Create and editor which includes rust code that uses br"\" or cr"\" raw strings.

Actual (Problematic) Behavior

The br and cr strings are treated as normal strings with escapes.

Expected Behavior

The br and cr strings should be treated as raw strings.

Additional Context

No response

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

Start with the linked Monaco Editor Playground and its Rust example to reproduce the behavior for br"..." and cr"..." strings. Trace the Rust language support responsible for string recognition, then verify that both prefixes are treated as raw strings rather than interpreting escapes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.