Skip to content

[Bug] Clicking on action lightbulb throws an error #3282

@raopg

Description

@raopg

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

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugcontextmenudiff-editor

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions