From f04f6cdae6c5d160eab0585903a8fdcd7e5339ca Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 24 Oct 2019 15:17:07 +0200 Subject: [PATCH] tweak download context keys --- .../platform/contextkey/common/contextkey.ts | 2 +- .../files/browser/fileActions.contribution.ts | 29 +++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/vs/platform/contextkey/common/contextkey.ts b/src/vs/platform/contextkey/common/contextkey.ts index 16e79df476f..d0654bc1caf 100644 --- a/src/vs/platform/contextkey/common/contextkey.ts +++ b/src/vs/platform/contextkey/common/contextkey.ts @@ -613,7 +613,7 @@ export class ContextKeyAndExpr implements ContextKeyExpr { if (e instanceof ContextKeyOrExpr) { // Not allowed, because we don't have parens! - throw new Error(`It is not allowed to have an or expression here due to lack of parens!`); + throw new Error(`It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.`); } expr.push(e); diff --git a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts index 3013c1eaa39..bc6b7792072 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts @@ -23,7 +23,7 @@ import { ResourceContextKey } from 'vs/workbench/common/resources'; import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys'; +import { WorkspaceFolderCountContext, IsWebContext } from 'vs/workbench/browser/contextkeys'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { OpenFileFolderAction, OpenFileAction, OpenFolderAction, OpenWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions'; import { ActiveEditorIsSaveableContext } from 'vs/workbench/common/editor'; @@ -464,24 +464,15 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { when: ExplorerFolderContext }); -MenuRegistry.appendMenuItem(MenuId.ExplorerContext, (() => { - const downloadMenuItem = { - group: '5_cutcopypaste', - order: 30, - command: { - id: DOWNLOAD_COMMAND_ID, - title: DOWNLOAD_LABEL, - }, - when: ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file)) - }; - - // Web: currently not supporting download of folders - if (isWeb) { - downloadMenuItem.when = ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), ExplorerFolderContext.toNegated()); - } - - return downloadMenuItem; -})()); +MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({ + group: '5_cutcopypaste', + order: 30, + command: { + id: DOWNLOAD_COMMAND_ID, + title: DOWNLOAD_LABEL, + }, + when: ContextKeyExpr.or(ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), IsWebContext.toNegated()), ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), ExplorerFolderContext.toNegated())) +})); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '6_copypath', -- GitLab