microsoft / microsoft/monaco-editor
[Bug] Incorrect CSS causes repaint with every caret blink
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
No response
Monaco Editor Playground Code
No response
Reproduction Steps
Enable "Paint Flashing" in Chrome dev tools (tested with Chrome 126.0.6478.127 on macOS 14.2.1 (23C71)).
In some cases, the dev tools paint reflash doesn't work for the embedded iframe in playground. However, the broken repaint on caret blink should still be observable in the editor on the left
Actual (Problematic) Behavior
- Try any monaco version after the referenced CSS change, including the latest one (
0.50.0) and observe the entire editor repaint with each caret blink
https://github.com/user-attachments/assets/e53de4d1-e800-474c-9e52-ed600700e10c
Expected Behavior
- Try again with a version before the referenced CSS change (eg:
0.43.0) and notice only the caret re-paints.
https://github.com/user-attachments/assets/d77c1383-5881-4a81-bd4e-d6e397237360
Additional Context
The CSS block here seems to be incorrect: https://github.com/microsoft/vscode/blob/1.91.1/src/vs/editor/standalone/browser/standalone-tokens.css#L40-L55
Presumably all the .monaco-editor, .monaco-diff-editor <foo> rules should instead be .monaco-editor <foo>, .monaco-diff-editor <foo>
As a side-effect, this change appears to cause the repaint on every caret blink as described above.
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
Inspect src/vs/editor/standalone/browser/standalone-tokens.css around lines 40-55, then reproduce the issue with Chrome DevTools Paint Flashing using a recent Monaco version and compare with 0.43.0. Done means the CSS selectors no longer trigger a full editor repaint on each caret blink, with only the caret repainting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100