microsoft / microsoft/monaco-editor
[Bug] `lightbulb` for `CodeAction` Not Showing When Text Has Only One Line
Open
@justschen is already working on this.
Since Oct 29, 2024.
bug
- 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 Link
Monaco Editor Playground Code
monaco.languages.register({id: "rule"})
monaco.languages.registerCodeActionProvider("rule", {
provideCodeActions: (model, range, context, token) => {
console.log("test");
return {
actions: [{
title: "Test",
ranges: [new monaco.Range(0, 0, 1, 1)],
command: {
id: "test",
arguments: []
}
}],
dispose: () => {}
}
},
resolveCodeAction: () => {
return null;
}
});
const model = monaco.editor.createModel("just for test", "rule", monaco.Uri.parse("inmemory://test"));
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
model,
theme: "vs-dark",
autoClosingQuotes: "always",
autoClosingBrackets: "always",
"semanticHighlighting.enabled": true,
wordWrap: 'on',
lineNumbersMinChars: 2,
overviewRulerLanes: 0,
overviewRulerBorder: false,
hideCursorInOverviewRuler: true,
glyphMargin: false,
folding: false,
scrollBeyondLastColumn: 0,
scrollBeyondLastLine: false,
quickSuggestionsDelay: 100,
scrollbar: { horizontal: 'hidden', vertical: 'hidden', alwaysConsumeMouseWheel: false },
minimap: { enabled: false },
});
Reproduction Steps
When clicking on the text to trigger the lightbulb, we notice that the lightbulb does not appear.
Actual (Problematic) Behavior
-
When there is only one line of text, the lightbulb icon does not appear.
-
When there are empty lines before and after the input text, the lightbulb icon displays correctly.
Expected Behavior
When there is no suitable position to display the lightbulb, it should be shown on the current line.
Additional Context
Maybe relative:
https://github.com/microsoft/vscode/issues/225459
https://github.com/microsoft/vscode/issues/213657
https://github.com/microsoft/vscode/pull/227138
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.