diff --git a/src/vs/workbench/parts/files/browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/browser/fileActions.contribution.ts index c966dc136d27df20e9fc2289c59b0a379fe1cde9..396a8a961197cd63c62d1274c51822e50d436d5f 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.contribution.ts @@ -123,7 +123,7 @@ class FilesViewerActionContributor extends ActionBarContributor { if (context && context.element instanceof FileStat) { // Any other item with keybinding - const keybinding = keybindingForAction(action.id); + const keybinding = keybindingForAction(action.id, this.keybindingService); if (keybinding) { return new ActionItem(context, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) }); } diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index c654aba4d432eb680ad8390f68111befc5553378..2463664c3d22d4979737465f48d37ebc532f434e 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -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) { case GlobalNewUntitledFileAction.ID: return new Keybinding(KeyMod.CtrlCmd | KeyCode.KEY_N); diff --git a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts index 6f1bb39273f72ca9b46876bd6d66b58d7c55199d..de3bd799aebd55e43f7948e710729634dd3e0439 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts @@ -34,6 +34,7 @@ import { ClickBehavior, DefaultController } from 'vs/base/parts/tree/browser/tre import { ActionsRenderer } from 'vs/base/parts/tree/browser/actionsRenderer'; import { FileStat, NewStatPlaceholder } from 'vs/workbench/parts/files/common/explorerViewModel'; 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 { IPartService } from 'vs/workbench/services/part/common/partService'; import { IWorkspace, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -389,7 +390,8 @@ export class FileController extends DefaultController { @ITelemetryService private telemetryService: ITelemetryService, @IWorkspaceContextService contextService: IWorkspaceContextService, @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 */ }); @@ -510,7 +512,7 @@ export class FileController extends DefaultController { }); }, 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) => { return { viewletState: this.state,