microsoft / microsoft/monaco-editor
[Bug] Incorrect syntax highlighting of Perl regex string
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?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `my \$regex = qr{\\W{1,10}}`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: "perl",
automaticLayout: true,
});
Reproduction Steps
Put the editor in Perl mode, type in my $regex = qr{\\W{1,10}}
Actual (Problematic) Behavior
The regular expression was interpreted as being closed by the first instance of } resulting in the second instance being highlighted red. See below:
Expected Behavior
The regular expression string should continue to be highlighted up to and including the second } as show in the vscode.dev screenshot below.
Additional Context
Correct syntax highlighting on vscode.dev:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Monaco Editor Playground, using the supplied TypeScript setup in Perl mode and the my $regex = qr{\\W{1,10}} example. Compare the highlighting around both closing braces with the expected vscode.dev behavior; done means the full regex remains highlighted through the second }.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100