Skip to content

Commit 0d8419a

Browse files
authored
1 parent b888f04 commit 0d8419a

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

src/vs/workbench/contrib/extensions/browser/extensionsActions.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,8 @@ export abstract class DropDownExtensionAction extends ExtensionAction {
11611161
return this._actionViewItem;
11621162
}
11631163

1164-
public override run({ actionGroups, disposeActionsOnHide }: { actionGroups: IAction[][]; disposeActionsOnHide: boolean }): Promise<any> {
1165-
this._actionViewItem?.showMenu(actionGroups, disposeActionsOnHide);
1164+
public override run(actionGroups: IAction[][]): Promise<any> {
1165+
this._actionViewItem?.showMenu(actionGroups);
11661166
return Promise.resolve();
11671167
}
11681168
}
@@ -1177,7 +1177,7 @@ export class DropDownExtensionActionViewItem extends ActionViewItem {
11771177
super(null, action, { ...options, icon: true, label: true });
11781178
}
11791179

1180-
public showMenu(menuActionGroups: IAction[][], disposeActionsOnHide: boolean): void {
1180+
public showMenu(menuActionGroups: IAction[][]): void {
11811181
if (this.element) {
11821182
const actions = this.getActions(menuActionGroups);
11831183
const elementPosition = DOM.getDomNodePagePosition(this.element);
@@ -1186,7 +1186,7 @@ export class DropDownExtensionActionViewItem extends ActionViewItem {
11861186
getAnchor: () => anchor,
11871187
getActions: () => actions,
11881188
actionRunner: this.actionRunner,
1189-
onHide: () => { if (disposeActionsOnHide) { disposeIfDisposable(actions); } }
1189+
onHide: () => disposeIfDisposable(actions)
11901190
});
11911191
}
11921192
}
@@ -1359,7 +1359,7 @@ export class ManageExtensionAction extends DropDownExtensionAction {
13591359

13601360
override async run(): Promise<any> {
13611361
await this.extensionService.whenInstalledExtensionsRegistered();
1362-
return super.run({ actionGroups: await this.getActionGroups(), disposeActionsOnHide: true });
1362+
return super.run(await this.getActionGroups());
13631363
}
13641364

13651365
update(): void {
@@ -1393,7 +1393,7 @@ export class ExtensionEditorManageExtensionAction extends DropDownExtensionActio
13931393
extensionAction.extension = this.extension;
13941394
}
13951395
}));
1396-
return super.run({ actionGroups, disposeActionsOnHide: true });
1396+
return super.run(actionGroups);
13971397
}
13981398

13991399
}
@@ -2473,16 +2473,14 @@ export class ToggleSyncExtensionAction extends DropDownExtensionAction {
24732473
}
24742474

24752475
override async run(): Promise<any> {
2476-
return super.run({
2477-
actionGroups: [
2478-
[
2479-
new Action(
2480-
'extensions.syncignore',
2481-
this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension!) ? localize('sync', "Sync this extension") : localize('do not sync', "Do not sync this extension")
2482-
, undefined, true, () => this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension!))
2483-
]
2484-
], disposeActionsOnHide: true
2485-
});
2476+
return super.run([
2477+
[
2478+
new Action(
2479+
'extensions.syncignore',
2480+
this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension!) ? localize('sync', "Sync this extension") : localize('do not sync', "Do not sync this extension")
2481+
, undefined, true, () => this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension!))
2482+
]
2483+
]);
24862484
}
24872485
}
24882486

src/vs/workbench/contrib/extensions/browser/extensionsViews.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { localize } from '../../../../nls.js';
7-
import { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
7+
import { Disposable, DisposableStore, isDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
88
import { Event, Emitter } from '../../../../base/common/event.js';
99
import { isCancellationError, getErrorMessage, CancellationError } from '../../../../base/common/errors.js';
1010
import { createErrorWithActions } from '../../../../base/common/errorMessage.js';
@@ -345,9 +345,15 @@ export class ExtensionsListView extends ViewPane {
345345
}
346346
}));
347347
}
348-
let actions: IAction[] = [];
348+
const actions: IAction[] = [];
349349
for (const menuActions of groups) {
350-
actions = [...actions, ...menuActions, new Separator()];
350+
for (const menuAction of menuActions) {
351+
actions.push(menuAction);
352+
if (isDisposable(menuAction)) {
353+
disposables.add(menuAction);
354+
}
355+
}
356+
actions.push(new Separator());
351357
}
352358
actions.pop();
353359
this.contextMenuService.showContextMenu({

0 commit comments

Comments
 (0)