提交 f04f6cda 编写于 作者: I isidor

tweak download context keys

上级 36bd747e
......@@ -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);
......
......@@ -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',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册