microsoft / microsoft/monaco-editor
[Bug] Glyph margin decorations/widgets for deleted lines not rendering in the inline view
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 originalModel = monaco.editor.createModel(
/* set from `originalModel`: */ `no red square for this line in the inline view
(uncomment \`renderSideBySide: false\`)`,
"text/plain"
);
const modifiedModel = monaco.editor.createModel(
/* set from `modifiedModel`: */ `green square for this line works in both cases`,
"text/plain"
);
const diffEditor = monaco.editor.createDiffEditor(
document.getElementById("container"),
{
originalEditable: true,
automaticLayout: true,
glyphMargin: true,
renderMarginRevertIcon: false,
// renderSideBySide: false,
}
);
diffEditor.setModel({
original: originalModel,
modified: modifiedModel,
});
for (const [editor, cls] of [
[diffEditor.getOriginalEditor(), 'original-decoration'],
[diffEditor.getModifiedEditor(), 'modified-decoration'],
]) {
editor.createDecorationsCollection([
{
range: new monaco.Range(1, 1, 1, 1),
options: {
glyphMarginClassName: cls,
},
},
]);
}
Reproduction Steps
Uncomment renderSideBySide: false.
Actual (Problematic) Behavior
The red square, which was present in the side-by-side view, disappears in the inline view.
Expected Behavior
The decorations should be rendered in both views.
Additional Context
It worked in v0.44.0.
I'm using createDecorationsCollection in the example, but the same happens with addGlyphMarginWidget.
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 and run it with renderSideBySide: false, comparing the original and modified glyph decorations. Trace the createDiffEditor inline rendering path, including createDecorationsCollection and addGlyphMarginWidget, and verify that decorations on deleted lines render in both inline and side-by-side views without regressing the v0.44.0 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100