Skip to content

Commit

Permalink
debt - fix leak with "Manage Extension" action in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Feb 7, 2025
1 parent e4c1bab commit f696d91
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/vs/workbench/api/browser/mainThreadProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@
import { IProgress, IProgressService, IProgressStep, ProgressLocation, IProgressOptions, IProgressNotificationOptions } from '../../../platform/progress/common/progress.js';
import { MainThreadProgressShape, MainContext, ExtHostProgressShape, ExtHostContext } from '../common/extHost.protocol.js';
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
import { Action } from '../../../base/common/actions.js';
import { ICommandService } from '../../../platform/commands/common/commands.js';
import { localize } from '../../../nls.js';
import { onUnexpectedExternalError } from '../../../base/common/errors.js';

class ManageExtensionAction extends Action {
constructor(extensionId: string, label: string, commandService: ICommandService) {
super(extensionId, label, undefined, true, () => {
return commandService.executeCommand('_extensions.manage', extensionId);
});
}
}
import { toAction } from '../../../base/common/actions.js';

@extHostNamedCustomer(MainContext.MainThreadProgress)
export class MainThreadProgress implements MainThreadProgressShape {
Expand Down Expand Up @@ -47,7 +39,11 @@ export class MainThreadProgress implements MainThreadProgressShape {
const notificationOptions: IProgressNotificationOptions = {
...options,
location: ProgressLocation.Notification,
secondaryActions: [new ManageExtensionAction(extensionId, localize('manageExtension', "Manage Extension"), this._commandService)]
secondaryActions: [toAction({
id: extensionId,
label: localize('manageExtension', "Manage Extension"),
run: () => this._commandService.executeCommand('_extensions.manage', extensionId)
})]
};

options = notificationOptions;
Expand Down

0 comments on commit f696d91

Please sign in to comment.