From 4e67ba102b8adf31171195d9810b7e18f8e0975d Mon Sep 17 00:00:00 2001 From: Justin Chen <54879025+justschen@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:14:18 -0800 Subject: [PATCH] dispose actions after selection/application of code action (#203936) dispose actions after selection and application of code action --- .../codeAction/browser/codeActionController.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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(); },