提交 26433f86 编写于 作者: J Johannes Rieken

don't show (or hide) lightbulb when there is something in the glyph margin, #11400

上级 5a9efd8a
......@@ -32,6 +32,12 @@ export class LightBulbWidget implements IOverlayWidget, IDisposable {
this._layout();
}
}));
this._toDispose.push(this._editor.onDidChangeModelDecorations(() => {
// hide when something has been added to glyph margin
if (this._visible && !this._hasSpaceInGlyphMargin(this._position.lineNumber)) {
this.hide();
}
}));
}
public dispose(): void {
......@@ -93,6 +99,9 @@ export class LightBulbWidget implements IOverlayWidget, IDisposable {
}
show(where: IPosition): void {
if (!this._hasSpaceInGlyphMargin(where.lineNumber)) {
return;
}
if (!this._visible || !Position.equals(this._position, where)) {
this._position = where;
this._visible = true;
......@@ -100,6 +109,15 @@ export class LightBulbWidget implements IOverlayWidget, IDisposable {
}
}
private _hasSpaceInGlyphMargin(line: number): boolean {
for (const {options} of this._editor.getLineDecorations(line)) {
if (options.glyphMarginClassName) {
return false;
}
}
return true;
}
private _layout(): void {
const topForLineNumber = this._editor.getTopForLineNumber(this._position.lineNumber);
const editorScrollTop = this._editor.getScrollTop();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册