monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] Clicking on action lightbulb throws an error

Open raopg opened this issue 3 years ago • 2 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

var originalModel = monaco.editor.createModel(
	'This line is removed on the right.\njust some text\nabcd\nefgh\nSome more text',
	'text/plain'
);
var modifiedModel = monaco.editor.createModel(
	'just some text\nabcz\nzzzzefgh\nSome more text\nThis line is removed on the left.',
	'text/plain'
);

var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
	// You can optionally disable the resizing
	enableSplitViewResizing: false,

	// Render the diff inline
	renderSideBySide: false
});
diffEditor.setModel({
	original: originalModel,
	modified: modifiedModel
});

Reproduction Steps

Click on the lightbulb icon in the editor playground. https://microsoft.github.io/monaco-editor/playground.html#creating-the-diffeditor-inline-diff-example

Actual (Problematic) Behavior

I see a console error:

dom.ts:462 Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
    at Object.O [as getDomNodePagePosition] (dom.ts:462:21)
    at u.doLayout (contextview.ts:324:33)
    at u.show (contextview.ts:220:8)
    at Ve.showContextView (contextViewService.ts:52:20)
    at Ve.showContextView (standaloneServices.ts:687:16)
    at u.showContextMenu (contextMenuHandler.ts:53:27)
    at tt.showContextMenu (contextMenuService.ts:45:27)
    at _ (inlineDiffMargin.ts:148:29)
    at inlineDiffMargin.ts:173:4
    at HTMLDivElement.<anonymous> (dom.ts:81:10)

Expected Behavior

The context menu would pop open

Additional Context

I can also reproduce this on a minimal creation of the code editor in React and Vite.

raopg avatar Sep 01 '22 22:09 raopg

This is what I see: https://microsoft.github.io/monaco-editor/playground.html?source=v0.36.1#XQAAAAKXAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw2FYXdHDtEDhQ6OU4assJFdYGava4wpdXLFRLNLFqJ8YUtwIBhVXikQrWprFr6cU-K_xWN6UbjDoeIlxIlkQ0ZXycT4SGEz5R8_2mcPFRNmcdINTgDBDZCurcSPvcrEKOeozp2Xu1an2K4_KBGPZppNGRkMtOGAHi4T2K8S4aMrySkivJjMyAid18k8J3sEmabdZBUy7768q2SKHRQ8pAgJqcBrtW2DRHDvMbOTerpCwrFH1UeJmOBDzJ9LYLOcQFUxYgyDbqQL73c3AA8IW3HpJJHO-BTvvh1cBF-T6sfQ8o7juEb2-VZd7qkOS6M020G2AQ0HCFj1gnA1h2Wyh5jLa-Hc0Hnxr-U7nMxpVoIZzpMOqMaEMKHORqiKVpLwVP6j5DKagtRvb-aM2eU6R79Yx-JHcDRNIL_Jj_5MY3Wg

image

Notice how the context menu does not seem to be styled.

hediet avatar Mar 13 '23 15:03 hediet

Please note that also happens when right clicking on the deleted line.

In 0.34.1 the menu still had a correct background:
image

In VS Code it's fine:
image

jairbubbles avatar May 15 '23 13:05 jairbubbles