fix lightbulb render location (#227138)

more lightbulb bugfixes
pull/227145/head
Justin Chen 2024-08-29 12:02:23 -07:00 committed by GitHub
parent f858b3223d
commit beefaee1b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 9 deletions

View File

@ -75,6 +75,14 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
private _gutterState: LightBulbState.State = LightBulbState.Hidden;
private _iconClasses: string[] = [];
private readonly lightbulbClasses = [
'codicon-' + GUTTER_LIGHTBULB_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AIFIX_AUTO_FIX_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AUTO_FIX_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AIFIX_ICON.id,
'codicon-' + GUTTER_SPARKLE_FILLED_ICON.id
];
private _preferredKbLabel?: string;
private _quickFixKbLabel?: string;
@ -148,15 +156,8 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
}));
this._register(this._editor.onMouseDown(async (e: IEditorMouseEvent) => {
const lightbulbClasses = [
'codicon-' + GUTTER_LIGHTBULB_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AIFIX_AUTO_FIX_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AUTO_FIX_ICON.id,
'codicon-' + GUTTER_LIGHTBULB_AIFIX_ICON.id,
'codicon-' + GUTTER_SPARKLE_FILLED_ICON.id
];
if (!e.target.element || !lightbulbClasses.some(cls => e.target.element && e.target.element.classList.contains(cls))) {
if (!e.target.element || !this.lightbulbClasses.some(cls => e.target.element && e.target.element.classList.contains(cls))) {
return;
}
@ -247,7 +248,9 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
let hasDecoration = false;
if (currLineDecorations) {
for (const decoration of currLineDecorations) {
if (decoration.options.glyphMarginClassName) {
const glyphClass = decoration.options.glyphMarginClassName;
if (glyphClass && !this.lightbulbClasses.some(className => glyphClass.includes(className))) {
hasDecoration = true;
break;
}