From 6472a8af6c7f8f2723521454aee7f2646e6bdf1c Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 15 Jan 2018 17:15:29 +0100 Subject: [PATCH] open editors: compare selected --- .../fileActions.contribution.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts index f9e193a5a78..448a7a7dff1 100644 --- a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts @@ -241,7 +241,7 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { title: nls.localize('compareWithSaved', "Compare with Saved"), precondition: DirtyEditorContext }, - when: ContextKeyExpr.and(ResourceContextKey.IsFile, AutoSaveContext.notEqualsTo('afterDelay')) + when: ContextKeyExpr.and(ResourceContextKey.IsFile, AutoSaveContext.notEqualsTo('afterDelay'), WorkbenchListDoubleSelection.toNegated()) }); const compareResourceCommand = { @@ -252,7 +252,7 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 20, command: compareResourceCommand, - when: ContextKeyExpr.and(ResourceContextKey.HasResource, ResourceSelectedForCompareContext) + when: ContextKeyExpr.and(ResourceContextKey.IsFile, ResourceSelectedForCompareContext, WorkbenchListDoubleSelection.toNegated()) }); const selectForCompareCommand = { @@ -263,7 +263,18 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 30, command: selectForCompareCommand, - when: ResourceContextKey.HasResource + when: ContextKeyExpr.and(ResourceContextKey.IsFile, WorkbenchListDoubleSelection.toNegated()) +}); + +const compareSelectedCommand = { + id: COMPARE_SELECTED_COMMAND_ID, + title: nls.localize('compareSelected', "Compare Selected") +}; +MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { + group: '3_compare', + order: 30, + command: compareSelectedCommand, + when: ContextKeyExpr.and(ResourceContextKey.IsFile, WorkbenchListDoubleSelection) }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { @@ -357,10 +368,7 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '3_compare', order: 30, - command: { - id: COMPARE_SELECTED_COMMAND_ID, - title: nls.localize('compareSelected', "Compare Selected") - }, + command: compareSelectedCommand, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ResourceContextKey.IsFile, WorkbenchListDoubleSelection) }); -- GitLab