Skip to content

Commit f04f6cd

Browse files
committed
tweak download context keys
1 parent 36bd747 commit f04f6cd

2 files changed

Lines changed: 11 additions & 20 deletions

File tree

src/vs/platform/contextkey/common/contextkey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
613613

614614
if (e instanceof ContextKeyOrExpr) {
615615
// Not allowed, because we don't have parens!
616-
throw new Error(`It is not allowed to have an or expression here due to lack of parens!`);
616+
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.`);
617617
}
618618

619619
expr.push(e);

src/vs/workbench/contrib/files/browser/fileActions.contribution.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ResourceContextKey } from 'vs/workbench/common/resources';
2323
import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService';
2424
import { URI } from 'vs/base/common/uri';
2525
import { Schemas } from 'vs/base/common/network';
26-
import { WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys';
26+
import { WorkspaceFolderCountContext, IsWebContext } from 'vs/workbench/browser/contextkeys';
2727
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
2828
import { OpenFileFolderAction, OpenFileAction, OpenFolderAction, OpenWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
2929
import { ActiveEditorIsSaveableContext } from 'vs/workbench/common/editor';
@@ -464,24 +464,15 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
464464
when: ExplorerFolderContext
465465
});
466466

467-
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, (() => {
468-
const downloadMenuItem = {
469-
group: '5_cutcopypaste',
470-
order: 30,
471-
command: {
472-
id: DOWNLOAD_COMMAND_ID,
473-
title: DOWNLOAD_LABEL,
474-
},
475-
when: ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file))
476-
};
477-
478-
// Web: currently not supporting download of folders
479-
if (isWeb) {
480-
downloadMenuItem.when = ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), ExplorerFolderContext.toNegated());
481-
}
482-
483-
return downloadMenuItem;
484-
})());
467+
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
468+
group: '5_cutcopypaste',
469+
order: 30,
470+
command: {
471+
id: DOWNLOAD_COMMAND_ID,
472+
title: DOWNLOAD_LABEL,
473+
},
474+
when: ContextKeyExpr.or(ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), IsWebContext.toNegated()), ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.file), ExplorerFolderContext.toNegated()))
475+
}));
485476

486477
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
487478
group: '6_copypath',

0 commit comments

Comments
 (0)