提交 a3d05a0f 编写于 作者: B Benjamin Pasero

show missing keybindings (part of #15742)

上级 5d31ec63
...@@ -123,7 +123,7 @@ class FilesViewerActionContributor extends ActionBarContributor { ...@@ -123,7 +123,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
if (context && context.element instanceof FileStat) { if (context && context.element instanceof FileStat) {
// Any other item with keybinding // Any other item with keybinding
const keybinding = keybindingForAction(action.id); const keybinding = keybindingForAction(action.id, this.keybindingService);
if (keybinding) { if (keybinding) {
return new ActionItem(context, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) }); return new ActionItem(context, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) });
} }
......
...@@ -1859,7 +1859,7 @@ export class RefreshExplorerView extends Action { ...@@ -1859,7 +1859,7 @@ export class RefreshExplorerView extends Action {
} }
} }
export function keybindingForAction(id: string, keybindingService?: IKeybindingService): Keybinding { export function keybindingForAction(id: string, keybindingService: IKeybindingService): Keybinding {
switch (id) { switch (id) {
case GlobalNewUntitledFileAction.ID: case GlobalNewUntitledFileAction.ID:
return new Keybinding(KeyMod.CtrlCmd | KeyCode.KEY_N); return new Keybinding(KeyMod.CtrlCmd | KeyCode.KEY_N);
......
...@@ -34,6 +34,7 @@ import { ClickBehavior, DefaultController } from 'vs/base/parts/tree/browser/tre ...@@ -34,6 +34,7 @@ import { ClickBehavior, DefaultController } from 'vs/base/parts/tree/browser/tre
import { ActionsRenderer } from 'vs/base/parts/tree/browser/actionsRenderer'; import { ActionsRenderer } from 'vs/base/parts/tree/browser/actionsRenderer';
import { FileStat, NewStatPlaceholder } from 'vs/workbench/parts/files/common/explorerViewModel'; import { FileStat, NewStatPlaceholder } from 'vs/workbench/parts/files/common/explorerViewModel';
import { DragMouseEvent, IMouseEvent } from 'vs/base/browser/mouseEvent'; import { DragMouseEvent, IMouseEvent } from 'vs/base/browser/mouseEvent';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IWorkspace, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkspace, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
...@@ -389,7 +390,8 @@ export class FileController extends DefaultController { ...@@ -389,7 +390,8 @@ export class FileController extends DefaultController {
@ITelemetryService private telemetryService: ITelemetryService, @ITelemetryService private telemetryService: ITelemetryService,
@IWorkspaceContextService contextService: IWorkspaceContextService, @IWorkspaceContextService contextService: IWorkspaceContextService,
@IMenuService menuService: IMenuService, @IMenuService menuService: IMenuService,
@IContextKeyService contextKeyService: IContextKeyService @IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService private keybindingService: IKeybindingService
) { ) {
super({ clickBehavior: ClickBehavior.ON_MOUSE_UP /* do not change to not break DND */ }); super({ clickBehavior: ClickBehavior.ON_MOUSE_UP /* do not change to not break DND */ });
...@@ -510,7 +512,7 @@ export class FileController extends DefaultController { ...@@ -510,7 +512,7 @@ export class FileController extends DefaultController {
}); });
}, },
getActionItem: this.state.actionProvider.getActionItem.bind(this.state.actionProvider, tree, stat), getActionItem: this.state.actionProvider.getActionItem.bind(this.state.actionProvider, tree, stat),
getKeyBinding: (a): Keybinding => keybindingForAction(a.id), getKeyBinding: (a): Keybinding => keybindingForAction(a.id, this.keybindingService),
getActionsContext: (event) => { getActionsContext: (event) => {
return { return {
viewletState: this.state, viewletState: this.state,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册