提交 e14e4357 编写于 作者: J Joao Moreno

Merge remote-tracking branch 'origin/master'

......@@ -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);
......
......@@ -14,7 +14,7 @@ import { openWindowCommand, COPY_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID,
import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { isMacintosh, isWeb } from 'vs/base/common/platform';
import { isMacintosh } from 'vs/base/common/platform';
import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerFolderContext, ExplorerResourceNotReadonlyContext, ExplorerResourceCut, IExplorerService, ExplorerResourceMoveableToTrash, ExplorerViewletVisibleContext } from 'vs/workbench/contrib/files/common/files';
import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vs/workbench/browser/actions/workspaceCommands';
import { CLOSE_SAVED_EDITORS_COMMAND_ID, CLOSE_EDITORS_IN_GROUP_COMMAND_ID, CLOSE_EDITOR_COMMAND_ID, CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
......@@ -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',
......
......@@ -552,7 +552,7 @@ interface MetaData<T, U> {
}
function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, any>[] | undefined): boolean {
function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, any>[] | undefined, allowEmptyArray: boolean = false): boolean {
if (value === undefined || value === null || properties === undefined) {
return true;
}
......@@ -561,7 +561,7 @@ function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, a
if (property !== undefined && property !== null) {
if (meta.type !== undefined && !meta.type.isEmpty(property)) {
return false;
} else if (!Array.isArray(property) || property.length > 0) {
} else if (!Array.isArray(property) || (property.length > 0) || allowEmptyArray) {
return false;
}
}
......@@ -591,11 +591,11 @@ function _assignProperties<T>(this: void, target: T | undefined, source: T | und
return target;
}
function _fillProperties<T>(this: void, target: T | undefined, source: T | undefined, properties: MetaData<T, any>[] | undefined): T | undefined {
function _fillProperties<T>(this: void, target: T | undefined, source: T | undefined, properties: MetaData<T, any>[] | undefined, allowEmptyArray: boolean = false): T | undefined {
if (!source || _isEmpty(source, properties)) {
return target;
}
if (!target || _isEmpty(target, properties)) {
if (!target || _isEmpty(target, properties, allowEmptyArray)) {
return source;
}
for (let meta of properties!) {
......@@ -727,7 +727,7 @@ namespace ShellConfiguration {
}
export function isEmpty(this: void, value: Tasks.ShellConfiguration): boolean {
return _isEmpty(value, properties);
return _isEmpty(value, properties, true);
}
export function assignProperties(this: void, target: Tasks.ShellConfiguration | undefined, source: Tasks.ShellConfiguration | undefined): Tasks.ShellConfiguration | undefined {
......@@ -735,7 +735,7 @@ namespace ShellConfiguration {
}
export function fillProperties(this: void, target: Tasks.ShellConfiguration, source: Tasks.ShellConfiguration): Tasks.ShellConfiguration | undefined {
return _fillProperties(target, source, properties);
return _fillProperties(target, source, properties, true);
}
export function fillDefaults(this: void, value: Tasks.ShellConfiguration, context: ParseContext): Tasks.ShellConfiguration {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册