Skip to content

Commit 5a53b4d

Browse files
committed
minimize changes
1 parent 5bb4f25 commit 5a53b4d

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/vs/platform/actions/browser/menuEntryActionViewItem.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { IdGenerator } from 'vs/base/common/idGenerator';
1212
import { IDisposable, toDisposable, MutableDisposable, DisposableStore } from 'vs/base/common/lifecycle';
1313
import { isLinux, isWindows } from 'vs/base/common/platform';
1414
import { localize } from 'vs/nls';
15-
import { IMenu, IMenuActionOptions, MenuItemAction, SubmenuItemAction, Icon } from 'vs/platform/actions/common/actions';
15+
import { ICommandAction, IMenu, IMenuActionOptions, MenuItemAction, SubmenuItemAction, Icon } from 'vs/platform/actions/common/actions';
1616
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1717
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1818
import { INotificationService } from 'vs/platform/notification/common/notification';
@@ -171,7 +171,7 @@ export class MenuEntryActionViewItem extends ActionViewItem {
171171
render(container: HTMLElement): void {
172172
super.render(container);
173173

174-
this._updateItemClass(this._action);
174+
this._updateItemClass(this._action.item);
175175

176176
let mouseOver = false;
177177

@@ -227,18 +227,18 @@ export class MenuEntryActionViewItem extends ActionViewItem {
227227
if (this.options.icon) {
228228
if (this._commandAction !== this._action) {
229229
if (this._action.alt) {
230-
this._updateItemClass(this._action.alt);
230+
this._updateItemClass(this._action.alt.item);
231231
}
232232
} else if ((<MenuItemAction>this._action).alt) {
233-
this._updateItemClass(this._action);
233+
this._updateItemClass(this._action.item);
234234
}
235235
}
236236
}
237237

238-
_updateItemClass(item: MenuItemAction): void {
238+
_updateItemClass(item: ICommandAction): void {
239239
this._itemClassDispose.value = undefined;
240240

241-
const icon = item.checked && (item.item.toggled as { icon?: Icon })?.icon ? (item.item.toggled as { icon: Icon }).icon : item.item.icon;
241+
const icon = this._commandAction.checked && (item.toggled as { icon?: Icon })?.icon ? (item.toggled as { icon: Icon }).icon : item.icon;
242242

243243
if (ThemeIcon.isThemeIcon(icon)) {
244244
// theme icons

src/vs/platform/actions/common/actions.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ export class MenuItemAction extends ExecuteCommandAction {
277277
@IContextKeyService contextKeyService: IContextKeyService,
278278
@ICommandService commandService: ICommandService
279279
) {
280-
super(item.id, typeof item.title === 'string' ? item.title : item.title.value, commandService);
281-
this.item = item;
280+
typeof item.title === 'string' ? super(item.id, item.title, commandService) : super(item.id, item.title.value, commandService);
281+
282282
this._cssClass = undefined;
283-
this._enabled = !this.item.precondition || contextKeyService.contextMatchesRules(this.item.precondition);
284-
this._tooltip = this.item.tooltip ? typeof this.item.tooltip === 'string' ? this.item.tooltip : this.item.tooltip.value : undefined;
283+
this._enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);
284+
this._tooltip = item.tooltip ? typeof item.tooltip === 'string' ? item.tooltip : item.tooltip.value : undefined;
285285

286-
if (this.item.toggled) {
287-
const toggled = ((this.item.toggled as { condition: ContextKeyExpression }).condition ? this.item.toggled : { condition: this.item.toggled }) as {
286+
if (item.toggled) {
287+
const toggled = ((item.toggled as { condition: ContextKeyExpression }).condition ? item.toggled : { condition: item.toggled }) as {
288288
condition: ContextKeyExpression, icon?: Icon, tooltip?: string | ILocalizedString
289289
};
290290
this._checked = contextKeyService.contextMatchesRules(toggled.condition);
@@ -295,6 +295,7 @@ export class MenuItemAction extends ExecuteCommandAction {
295295

296296
this._options = options || {};
297297

298+
this.item = item;
298299
this.alt = alt ? new MenuItemAction(alt, undefined, this._options, contextKeyService, commandService) : undefined;
299300
}
300301

src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export class CommandsHandler extends QuickOpenHandler implements IDisposable {
591591
const aliasHighlights = alias ? wordFilter(searchValue, alias) : null;
592592

593593
if (labelHighlights || aliasHighlights) {
594-
entries.push(this.instantiationService.createInstance(ActionCommandEntry, action.id, this.keybindingService.lookupKeybinding(action.id), label, alias, { label: labelHighlights, alias: aliasHighlights }, action, (id: string) => this.onBeforeRunCommand(id)));
594+
entries.push(this.instantiationService.createInstance(ActionCommandEntry, action.item.id, this.keybindingService.lookupKeybinding(action.id), label, alias, { label: labelHighlights, alias: aliasHighlights }, action, (id: string) => this.onBeforeRunCommand(id)));
595595
}
596596
}
597597
}

src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class RemoteWindowActiveIndicator extends Disposable implements IWorkbenc
207207
}
208208
items.push({
209209
type: 'item',
210-
id: action.id,
210+
id: action.item.id,
211211
label
212212
});
213213
}

src/vs/workbench/electron-browser/window.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
2323
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
2424
import { ipcRenderer as ipc, webFrame, crashReporter, CrashReporterStartOptions, Event as IpcEvent } from 'electron';
2525
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
26-
import { IMenuService, MenuId, IMenu, MenuItemAction, SubmenuItemAction, MenuRegistry, ICommandAction } from 'vs/platform/actions/common/actions';
26+
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
2727
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
2828
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
2929
import { RunOnceScheduler } from 'vs/base/common/async';
@@ -511,7 +511,7 @@ export class NativeWindow extends Disposable {
511511

512512
// Command
513513
if (action instanceof MenuItemAction) {
514-
if (ignoredItems.indexOf(action.id) >= 0) {
514+
if (ignoredItems.indexOf(action.item.id) >= 0) {
515515
continue; // ignored
516516
}
517517

0 commit comments

Comments
 (0)