microsoft / microsoft/monaco-editor
[Bug] Runtime theme change produces incorrect strings highlighting inside of colorize element
Open
Nobody has claimed this yet.
bug
tokenization
- 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
// The colorizeElement-function will read the data-lang-attribute
// from the element to select the correct language mode. In this
// sample it is text/css.
monaco.editor.colorizeElement(document.getElementById("code"), { theme: 'vs-light' });
setTimeout(() => {
monaco.editor.setTheme('vs-dark');
}, 1000)
Reproduction Steps
- Colorize element using
monaco.editor.colorizeElement - Change theme in runtime from 'vs-light' to 'vs-dark' (working with any couple of themes)
Actual (Problematic) Behavior
all of "String" kind tokens will have a red color.
Expected Behavior
Expected: all of "String" kind tokens will have a themed color for current token kind.
Additional Context
No response
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 and reproduce the issue using monaco.editor.colorizeElement, then switch themes with monaco.editor.setTheme. Trace how the colorized element handles the runtime theme update; done means String tokens use the current theme's token color instead of turning red.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100