microsoft / microsoft/monaco-editor

IModelDecorationOptions IsWholeLine extends range in unexpected ways

Open
#4,784 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

https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.2#example-interacting-with-the-editor-line-and-inline-decorations

Monaco Editor Playground Code
Nothing special, just using the decorations example
Reproduction Steps
  1. Notice the line decoration spans lines 3-5 and has isWholeLine = true
  2. Select and delete lines 3-5
  3. Notice that line 2 now has the line decoration
  4. Ctrl+z until lines 3-5 are restored
  5. 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.