提交 6887b7c8 编写于 作者: J Johannes Rieken

fix #47842

上级 bacf6a13
......@@ -148,7 +148,7 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
if (!config.contribInfo.lightbulbEnabled) {
return;
}
const { lineNumber } = this._model.position;
const { lineNumber, column } = this._model.position;
const model = this._editor.getModel();
if (!model) {
return;
......@@ -158,7 +158,9 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
const lineContent = model.getLineContent(lineNumber);
const indent = TextModel.computeIndentLevel(lineContent, tabSize);
const lineHasSpace = config.fontInfo.spaceWidth * indent > 22;
const isFolded = lineNumber => lineNumber > 2 && this._editor.getTopForLineNumber(lineNumber) === this._editor.getTopForLineNumber(lineNumber - 1);
const isFolded = (lineNumber) => {
return lineNumber > 2 && this._editor.getTopForLineNumber(lineNumber) === this._editor.getTopForLineNumber(lineNumber - 1);
};
let effectiveLineNumber = lineNumber;
if (!lineHasSpace) {
......@@ -166,6 +168,11 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
effectiveLineNumber -= 1;
} else if (!isFolded(lineNumber + 1)) {
effectiveLineNumber += 1;
} else if (column * config.fontInfo.spaceWidth < 22) {
// cannot show lightbulb above/below and showing
// it inline would overlay the cursor...
this.hide();
return;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册