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 f9e193a5a78808ba241b65a4da1f7b20700d73a6..448a7a7dff139d270c7d64b25e204b5bf19000e8 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) });