diff --git a/src/vs/editor/contrib/codeAction/browser/codeActionController.ts b/src/vs/editor/contrib/codeAction/browser/codeActionController.ts index 3fbf1bf476b..21f1faa46a0 100644 --- a/src/vs/editor/contrib/codeAction/browser/codeActionController.ts +++ b/src/vs/editor/contrib/codeAction/browser/codeActionController.ts @@ -112,7 +112,12 @@ export class CodeActionController extends Disposable implements IEditorContribut command.arguments[0] = { ...command.arguments[0], autoSend: false }; } } - await this._applyCodeAction(actionItem, false, false, ApplyCodeActionReason.FromAILightbulb); + try { + this._lightBulbWidget.value?.hide(); + await this._applyCodeAction(actionItem, false, false, ApplyCodeActionReason.FromAILightbulb); + } finally { + actions.dispose(); + } return; } await this.showCodeActionList(actions, at, { includeDisabledActions: false, fromLightbulb: true }); @@ -279,7 +284,11 @@ export class CodeActionController extends Disposable implements IEditorContribut const delegate: IActionListDelegate = { onSelect: async (action: CodeActionItem, preview?: boolean) => { - this._applyCodeAction(action, /* retrigger */ true, !!preview, ApplyCodeActionReason.FromCodeActions); + try { + await this._applyCodeAction(action, /* retrigger */ true, !!preview, ApplyCodeActionReason.FromCodeActions); + } finally { + actions.dispose(); + } this._actionWidgetService.hide(); currentDecorations.clear(); },