microsoft / microsoft/monaco-editor
IModelDecorationOptions IsWholeLine extends range in unexpected ways
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
Nothing special, just using the decorations example
Reproduction Steps
- Notice the line decoration spans lines 3-5 and has isWholeLine = true
- Select and delete lines 3-5
- Notice that line 2 now has the line decoration
- Ctrl+z until lines 3-5 are restored
- Notice that the decoration now spans lines 2-5
Actual (Problematic) Behavior
Decorating a line that was never marked to be decorated is unexpected. The decoration was for line 3-5, so having line 2 decorated once 3-5 are deleted decorates something that was never the original intention. Ditto to line 2 still being decorated after the undo.
Expected Behavior
If a decorated line is deleted I would expect the decoration to be deleted as well, not move to a previously undecorated line. Granted, I could be missing some other context, but from evaluating Monaco as a potential replacement in our app, this is something that stood out as unexpected and would make it challenging to use full line decorations (something that we currently do a lot)
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 example, focusing on the IModelDecorationOptions isWholeLine behavior and the line-decoration reproduction steps. Verify deletion and undo across lines 2-5, then trace the relevant decoration behavior and tests. Done means deleted decorated lines no longer cause the decoration to appear on a previously undecorated line.
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
- 38/100