microsoft / microsoft/monaco-editor

[Bug] Glyph margin decorations/widgets for deleted lines not rendering in the inline view

Open
#4,475 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.47.0#XQAAAAKlBAAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw6bPERgmSatbNyrNa50VLHWwDOn0YI7IfU0xJ0CGYU1vRtgnKPmZzQcQ1L9J7fCG48SpY2EIkpDE0S8hEos9zg16lVINwY-fM3J9agIl2KNT2KoxKDytjdhdTnlGRxapQn-L4i1mZCBCuFpJv8-jOytdnF35-qc_NcMfRUQzdAaP6gIhsifxhK6P5ItpA38PDWPicbFmO7MvI_arB3bBJ3imjWCQuJsrUK1XEBZvSKWQL5SEUpbogJank95PNiN0SrYlHmf79jrB0D8KU9rzy9ZJ_3CzzqnvON9iAPjYEVVQqjJMxUW1Q9OZ--mzd8L1NhmZ2UUqdapLyjKVwyin5kXNumW5FfbA7POwUL7fEsvgSUqR4Gn2eZV7VOaAPUwtNZg5biYF4an9rBRTPTl-wkg2S7Xj2W2_nMmH-iHNeSsAvqmUO5OZF_8v4pRlYqFLxnvbZIQ31Mh1cfMO_Lk0hP3MBzK_7kIVbU15-RCimVLrNByTDpE-Khmve3-NRKVp8VQ5K4n85odQKCk2NX-QkmFKzolCRGP1ihTAx9SOxJWRN4K_gvDSFNWKFkuqMnFdBmcRR5S7yw5BGW_SC7Y1519LWaO-kDDlf89_zB38dzU5qiBJmABKklLaF_yAJwbPDcKqwKynH1W6Ce6Qib-R0jhmNOsH_e3VFAA

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.