mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-11 09:09:46 +01:00
debt - fix leaks in updating recently opened menu (#192964)
This commit is contained in:
@@ -265,7 +265,7 @@ export function toAction(props: { id: string; label: string; enabled?: boolean;
|
||||
class: undefined,
|
||||
enabled: props.enabled ?? true,
|
||||
checked: props.checked ?? false,
|
||||
run: async () => props.run(),
|
||||
run: async (...args: unknown[]) => props.run(),
|
||||
tooltip: props.label
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
|
||||
import { IMenuService, MenuId, IMenu, SubmenuItemAction, registerAction2, Action2, MenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable, getMenuBarVisibility } from 'vs/platform/window/common/window';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IAction, Action, SubmenuAction, Separator, IActionRunner, ActionRunner, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification } from 'vs/base/common/actions';
|
||||
import { IAction, Action, SubmenuAction, Separator, IActionRunner, ActionRunner, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification, toAction } from 'vs/base/common/actions';
|
||||
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { isMacintosh, isWeb, isIOS, isNative } from 'vs/base/common/platform';
|
||||
@@ -331,14 +331,15 @@ export abstract class MenubarControl extends Disposable {
|
||||
openable = { fileUri: uri };
|
||||
}
|
||||
|
||||
const ret: IAction = new Action(commandId, unmnemonicLabel(label), undefined, undefined, event => {
|
||||
const browserEvent = event as KeyboardEvent;
|
||||
const openInNewWindow = event && ((!isMacintosh && (browserEvent.ctrlKey || browserEvent.shiftKey)) || (isMacintosh && (browserEvent.metaKey || browserEvent.altKey)));
|
||||
const ret = toAction({
|
||||
id: commandId, label: unmnemonicLabel(label), run: (browserEvent: KeyboardEvent) => {
|
||||
const openInNewWindow = browserEvent && ((!isMacintosh && (browserEvent.ctrlKey || browserEvent.shiftKey)) || (isMacintosh && (browserEvent.metaKey || browserEvent.altKey)));
|
||||
|
||||
return this.hostService.openWindow([openable], {
|
||||
forceNewWindow: !!openInNewWindow,
|
||||
remoteAuthority: remoteAuthority || null // local window if remoteAuthority is not set or can not be deducted from the openable
|
||||
});
|
||||
return this.hostService.openWindow([openable], {
|
||||
forceNewWindow: !!openInNewWindow,
|
||||
remoteAuthority: remoteAuthority || null // local window if remoteAuthority is not set or can not be deducted from the openable
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return Object.assign(ret, { uri, remoteAuthority });
|
||||
|
||||
Reference in New Issue
Block a user