microsoft / microsoft/monaco-editor
[Bug] Clicking on action lightbulb throws an error
Open
@alexdima is already working on this.
Since Feb 7, 2023.
bug
contextmenu
diff-editor
- 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 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.
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.
Assessment
This issue has not been assessed yet.