microsoft / monaco-editor

A browser based code editor

Home Page:https://microsoft.github.io/monaco-editor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

adamsol opened this issue · comments

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.