提交 27e9d4c1 编写于 作者: J Johannes Rieken

debt - rename clone to deepClone

上级 a71aa061
......@@ -39,7 +39,7 @@ export class Checkbox extends Widget {
constructor(opts: ICheckboxOpts) {
super();
this._opts = objects.clone(opts);
this._opts = objects.deepClone(opts);
objects.mixin(this._opts, defaultOpts, false);
this._checked = this._opts.isChecked;
......
......@@ -12,7 +12,7 @@ import { Widget } from 'vs/base/browser/ui/widget';
import * as dom from 'vs/base/browser/dom';
import * as arrays from 'vs/base/common/arrays';
import { Color } from 'vs/base/common/color';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
export interface ISelectBoxStyles {
selectBackground?: Color;
......@@ -42,7 +42,7 @@ export class SelectBox extends Widget {
private selectForeground: Color;
private selectBorder: Color;
constructor(options: string[], selected: number, styles: ISelectBoxStyles = clone(defaultStyles)) {
constructor(options: string[], selected: number, styles: ISelectBoxStyles = deepClone(defaultStyles)) {
super();
this.selectElement = document.createElement('select');
......@@ -152,4 +152,4 @@ export class SelectBox extends Widget {
this.toDispose = dispose(this.toDispose);
super.dispose();
}
}
\ No newline at end of file
}
......@@ -7,7 +7,7 @@
import { isObject, isUndefinedOrNull, isArray } from 'vs/base/common/types';
export function clone<T>(obj: T): T {
export function deepClone<T>(obj: T): T {
if (!obj || typeof obj !== 'object') {
return obj;
}
......@@ -18,7 +18,7 @@ export function clone<T>(obj: T): T {
const result: any = Array.isArray(obj) ? [] : {};
Object.keys(obj).forEach((key: keyof T) => {
if (obj[key] && typeof obj[key] === 'object') {
result[key] = clone(obj[key]);
result[key] = deepClone(obj[key]);
} else {
result[key] = obj[key];
}
......
......@@ -237,7 +237,7 @@ export class ExecutableParser extends Parser {
result.cwd = json.cwd;
}
if (!Types.isUndefined(json.env)) {
result.env = Objects.clone(json.env);
result.env = Objects.deepClone(json.env);
}
return result;
}
......
......@@ -212,7 +212,7 @@ export abstract class AbstractProcess<TProgressData> {
cc(result);
};
if (this.shell && Platform.isWindows) {
let options: any = Objects.clone(this.options);
let options: any = Objects.deepClone(this.options);
options.windowsVerbatimArguments = true;
options.detached = false;
let quotedCommand: boolean = false;
......
......@@ -7,7 +7,7 @@ import { ChildProcess, fork } from 'child_process';
import { IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { Delayer } from 'vs/base/common/async';
import { clone, assign } from 'vs/base/common/objects';
import { deepClone, assign } from 'vs/base/common/objects';
import { Emitter, fromNodeEventEmitter } from 'vs/base/common/event';
import { createQueuedSender } from 'vs/base/node/processes';
import { ChannelServer as IPCServer, ChannelClient as IPCClient, IChannelClient, IChannel } from 'vs/base/parts/ipc/common/ipc';
......@@ -127,7 +127,7 @@ export class Client implements IChannelClient, IDisposable {
const args = this.options && this.options.args ? this.options.args : [];
const forkOpts = Object.create(null);
forkOpts.env = assign(clone(process.env), { 'VSCODE_PARENT_PID': String(process.pid) });
forkOpts.env = assign(deepClone(process.env), { 'VSCODE_PARENT_PID': String(process.pid) });
if (this.options && this.options.env) {
forkOpts.env = assign(forkOpts.env, this.options.env);
......
......@@ -14,7 +14,7 @@ import processes = require('vs/base/node/processes');
function fork(id: string): cp.ChildProcess {
const opts: any = {
env: objects.mixin(objects.clone(process.env), {
env: objects.mixin(objects.deepClone(process.env), {
AMD_ENTRYPOINT: id,
PIPE_LOGGING: 'true',
VERBOSE_LOGGING: true
......@@ -86,4 +86,4 @@ suite('Processes', () => {
}
});
});
});
\ No newline at end of file
});
......@@ -919,7 +919,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _adjustOptionsForSubEditor(options: editorOptions.IDiffEditorOptions): editorOptions.IDiffEditorOptions {
let clonedOptions: editorOptions.IDiffEditorOptions = objects.clone(options || {});
let clonedOptions: editorOptions.IDiffEditorOptions = objects.deepClone(options || {});
clonedOptions.inDiffEditor = true;
clonedOptions.wordWrap = 'off';
clonedOptions.wordWrapMinified = false;
......
......@@ -174,7 +174,7 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
constructor(editor: ICodeEditor, options: IOptions = {}) {
this.editor = editor;
this.options = objects.clone(options);
this.options = objects.deepClone(options);
objects.mixin(this.options, defaultOptions, false);
this.domNode = document.createElement('div');
if (!this.options.isAccessible) {
......
......@@ -59,7 +59,7 @@ export class ConfigurationModel implements IConfigurationModel {
if (overrideContentsForKey) {
// Clone and merge only if base contents and override contents are of type object otherwise just override
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
contentsForKey = objects.clone(contentsForKey);
contentsForKey = objects.deepClone(contentsForKey);
this.mergeContents(contentsForKey, overrideContentsForKey);
} else {
contentsForKey = overrideContentsForKey;
......@@ -73,8 +73,8 @@ export class ConfigurationModel implements IConfigurationModel {
}
merge(...others: ConfigurationModel[]): ConfigurationModel {
const contents = objects.clone(this.contents);
const overrides = objects.clone(this.overrides);
const contents = objects.deepClone(this.contents);
const overrides = objects.deepClone(this.overrides);
const keys = [...this.keys];
for (const other of others) {
......@@ -110,7 +110,7 @@ export class ConfigurationModel implements IConfigurationModel {
continue;
}
}
source[key] = objects.clone(target[key]);
source[key] = objects.deepClone(target[key]);
}
}
......@@ -354,7 +354,7 @@ export class Configuration {
workspaceFolder: string[];
} {
const folderConfigurationModel = this.getFolderConfigurationModelForResource(null, workspace);
return objects.clone({
return objects.deepClone({
default: this._defaultConfiguration.freeze().keys,
user: this._userConfiguration.freeze().keys,
workspace: this._workspaceConfiguration.freeze().keys,
......@@ -634,4 +634,4 @@ export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent i
}
return changedConfigurationByResource;
}
}
\ No newline at end of file
}
......@@ -11,7 +11,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import types = require('vs/base/common/types');
import * as strings from 'vs/base/common/strings';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
export const Extensions = {
Configuration: 'base.contributions.configuration'
......@@ -223,7 +223,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
if (properties) {
for (let key in properties) {
settingsSchema.properties[key] = properties[key];
resourceSettingsSchema.properties[key] = clone(properties[key]);
resourceSettingsSchema.properties[key] = deepClone(properties[key]);
if (properties[key].scope !== ConfigurationScope.RESOURCE) {
resourceSettingsSchema.properties[key].doNotSuggest = true;
}
......@@ -322,4 +322,4 @@ export function validateProperty(property: string): string {
export function getScopes(keys: string[]): ConfigurationScope[] {
const configurationProperties = configurationRegistry.getConfigurationProperties();
return keys.map(key => configurationProperties[key].scope);
}
\ No newline at end of file
}
......@@ -379,7 +379,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
} else {
// Only the last pattern can loop
if (pattern.loop && i === this.patterns.length - 1) {
data = Objects.clone(data);
data = Objects.deepClone(data);
}
this.fillProblemData(data, pattern, matches);
}
......@@ -399,7 +399,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
this.data = null;
return null;
}
let data = Objects.clone(this.data);
let data = Objects.deepClone(this.data);
this.fillProblemData(data, pattern, matches);
return this.getMarkerMatch(data);
}
......@@ -911,8 +911,8 @@ export namespace Schemas {
}
};
export const NamedProblemPattern: IJSONSchema = Objects.clone(ProblemPattern);
NamedProblemPattern.properties = Objects.clone(NamedProblemPattern.properties);
export const NamedProblemPattern: IJSONSchema = Objects.deepClone(ProblemPattern);
NamedProblemPattern.properties = Objects.deepClone(NamedProblemPattern.properties);
NamedProblemPattern.properties['name'] = {
type: 'string',
description: localize('NamedProblemPatternSchema.name', 'The name of the problem pattern.')
......@@ -1215,7 +1215,7 @@ export class ProblemMatcherParser extends Parser {
if (variableName.length > 1 && variableName[0] === '$') {
let base = ProblemMatcherRegistry.get(variableName.substring(1));
if (base) {
result = Objects.clone(base);
result = Objects.deepClone(base);
if (description.owner) {
result.owner = owner;
}
......@@ -1475,8 +1475,8 @@ export namespace Schemas {
}
};
export const LegacyProblemMatcher: IJSONSchema = Objects.clone(ProblemMatcher);
LegacyProblemMatcher.properties = Objects.clone(LegacyProblemMatcher.properties);
export const LegacyProblemMatcher: IJSONSchema = Objects.deepClone(ProblemMatcher);
LegacyProblemMatcher.properties = Objects.deepClone(LegacyProblemMatcher.properties);
LegacyProblemMatcher.properties['watchedTaskBeginsRegExp'] = {
type: 'string',
deprecationMessage: localize('LegacyProblemMatcherSchema.watchedBegin.deprecated', 'This property is deprecated. Use the watching property instead.'),
......@@ -1488,8 +1488,8 @@ export namespace Schemas {
description: localize('LegacyProblemMatcherSchema.watchedEnd', 'A regular expression signaling that a watched tasks ends executing.')
};
export const NamedProblemMatcher: IJSONSchema = Objects.clone(ProblemMatcher);
NamedProblemMatcher.properties = Objects.clone(NamedProblemMatcher.properties);
export const NamedProblemMatcher: IJSONSchema = Objects.deepClone(ProblemMatcher);
NamedProblemMatcher.properties = Objects.deepClone(NamedProblemMatcher.properties);
NamedProblemMatcher.properties.name = {
type: 'string',
description: localize('NamedProblemMatcherSchema.name', 'The name of the problem matcher used to refer to it.')
......
......@@ -199,8 +199,8 @@ export function getExcludes(configuration: ISearchConfiguration): glob.IExpressi
let allExcludes: glob.IExpression = Object.create(null);
// clone the config as it could be frozen
allExcludes = objects.mixin(allExcludes, objects.clone(fileExcludes));
allExcludes = objects.mixin(allExcludes, objects.clone(searchExcludes), true);
allExcludes = objects.mixin(allExcludes, objects.deepClone(fileExcludes));
allExcludes = objects.mixin(allExcludes, objects.deepClone(searchExcludes), true);
return allExcludes;
}
......
......@@ -7,7 +7,7 @@
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
/* __GDPR__FRAGMENT__
"IExperiments" : {
......@@ -89,5 +89,5 @@ function splitRandom(random: number): [number, boolean] {
}
function getExperimentsOverrides(configurationService: IConfigurationService): IExperiments {
return clone(configurationService.getValue<any>('experiments')) || {};
return deepClone(configurationService.getValue<any>('experiments')) || {};
}
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { mixin, clone } from 'vs/base/common/objects';
import { mixin, deepClone } from 'vs/base/common/objects';
import URI from 'vs/base/common/uri';
import Event, { Emitter } from 'vs/base/common/event';
import * as vscode from 'vscode';
......@@ -61,7 +61,7 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
}
getConfiguration(section?: string, resource?: URI, extensionId?: string): vscode.WorkspaceConfiguration {
const config = clone(section
const config = deepClone(section
? lookUp(this._configuration.getValue(null, { resource }, this._extHostWorkspace.workspace), section)
: this._configuration.getValue(null, { resource }, this._extHostWorkspace.workspace));
......@@ -107,7 +107,7 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
},
inspect: <T>(key: string): ConfigurationInspect<T> => {
key = section ? `${section}.${key}` : key;
const config = clone(this._configuration.inspect<T>(key, { resource }, this._extHostWorkspace.workspace));
const config = deepClone(this._configuration.inspect<T>(key, { resource }, this._extHostWorkspace.workspace));
if (config) {
return {
key,
......
......@@ -174,7 +174,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
]
}
*/
this.telemetryService.publicLog('workbenchEditorConfiguration', objects.clone(editorConfig)); // Clone because telemetry service will modify the passed data by adding more details.
this.telemetryService.publicLog('workbenchEditorConfiguration', objects.deepClone(editorConfig)); // Clone because telemetry service will modify the passed data by adding more details.
} else {
this.tabOptions = {
previewEditors: true,
......@@ -229,7 +229,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
});
}
const oldTabOptions = objects.clone(this.tabOptions);
const oldTabOptions = objects.deepClone(this.tabOptions);
this.tabOptions = {
previewEditors: newPreviewEditors,
showIcons: editorConfig.showIcons,
......
......@@ -56,7 +56,7 @@ import { widgetShadow, editorWidgetBackground } from 'vs/platform/theme/common/c
// tslint:disable-next-line:import-patterns
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport {
......@@ -979,7 +979,7 @@ export class ChangeModeAction extends Action {
}
// Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config
let currentAssociations = clone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user);
let currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user);
if (!currentAssociations) {
currentAssociations = Object.create(null);
}
......
......@@ -92,7 +92,7 @@ export abstract class BaseTextEditor extends BaseEditor {
protected computeConfiguration(configuration: IEditorConfiguration): IEditorOptions {
// Specific editor options always overwrite user configuration
const editorConfiguration: IEditorOptions = types.isObject(configuration.editor) ? objects.clone(configuration.editor) : Object.create(null);
const editorConfiguration: IEditorOptions = types.isObject(configuration.editor) ? objects.deepClone(configuration.editor) : Object.create(null);
objects.assign(editorConfiguration, this.getConfigurationOverrides());
// ARIA label
......
......@@ -114,7 +114,7 @@ export class ResourceGlobMatcher {
changed = true;
this.mapRootToParsedExpression.set(folder.uri.toString(), parse(rootExcludes));
this.mapRootToExpressionConfig.set(folder.uri.toString(), objects.clone(rootExcludes));
this.mapRootToExpressionConfig.set(folder.uri.toString(), objects.deepClone(rootExcludes));
}
});
......@@ -138,7 +138,7 @@ export class ResourceGlobMatcher {
changed = true;
this.mapRootToParsedExpression.set(ResourceGlobMatcher.NO_ROOT, parse(globalExcludes));
this.mapRootToExpressionConfig.set(ResourceGlobMatcher.NO_ROOT, objects.clone(globalExcludes));
this.mapRootToExpressionConfig.set(ResourceGlobMatcher.NO_ROOT, objects.deepClone(globalExcludes));
}
if (fromEvent && changed) {
......
......@@ -299,7 +299,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
!breakpoint.condition && !breakpoint.hitCondition ? DebugEditorModelManager.BREAKPOINT_DECORATION : null;
if (result) {
result = objects.clone(result);
result = objects.deepClone(result);
if (breakpoint.message) {
result.glyphMarginHoverMessage = new MarkdownString().appendText(breakpoint.message);
}
......
......@@ -484,7 +484,7 @@ class Launch implements ILaunch {
}
public resolveConfiguration(config: IConfig): TPromise<IConfig> {
const result = objects.clone(config) as IConfig;
const result = objects.deepClone(config) as IConfig;
// Set operating system specific properties #1873
const setOSProperties = (flag: boolean, osConfig: IEnvConfig) => {
if (flag && osConfig) {
......
......@@ -208,7 +208,7 @@ export class Adapter {
};
properties['internalConsoleOptions'] = INTERNAL_CONSOLE_OPTIONS_SCHEMA;
const osProperties = objects.clone(properties);
const osProperties = objects.deepClone(properties);
properties['windows'] = {
type: 'object',
description: nls.localize('debugWindowsConfiguration', "Windows specific launch configuration attributes."),
......
......@@ -693,7 +693,7 @@ export class FileFilter implements IFilter {
const configuration = this.configurationService.getValue<IFilesConfiguration>({ resource: folder.uri });
const excludesConfig = (configuration && configuration.files && configuration.files.exclude) || Object.create(null);
needsRefresh = needsRefresh || !objects.equals(this.hiddenExpressionPerRoot.get(folder.uri.toString()), excludesConfig);
this.hiddenExpressionPerRoot.set(folder.uri.toString(), objects.clone(excludesConfig)); // do not keep the config, as it gets mutated under our hoods
this.hiddenExpressionPerRoot.set(folder.uri.toString(), objects.deepClone(excludesConfig)); // do not keep the config, as it gets mutated under our hoods
});
return needsRefresh;
......
......@@ -64,7 +64,7 @@ namespace Configuration {
}
}
}
return { extensionId, taskType, required: required.length >= 0 ? required : undefined, properties: value.properties ? Objects.clone(value.properties) : undefined };
return { extensionId, taskType, required: required.length >= 0 ? required : undefined, properties: value.properties ? Objects.deepClone(value.properties) : undefined };
}
}
......@@ -126,4 +126,4 @@ class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
}
}
export const TaskDefinitionRegistry: ITaskDefinitionRegistry = new TaskDefinitionRegistryImpl();
\ No newline at end of file
export const TaskDefinitionRegistry: ITaskDefinitionRegistry = new TaskDefinitionRegistryImpl();
......@@ -62,11 +62,11 @@ const shellCommand: IJSONSchema = {
description: nls.localize('JsonSchema.shell', 'Specifies whether the command is a shell command or an external program. Defaults to false if omitted.')
};
schema.definitions = Objects.clone(commonSchema.definitions);
schema.definitions = Objects.deepClone(commonSchema.definitions);
let definitions = schema.definitions;
definitions['commandConfiguration']['properties']['isShellCommand'] = Objects.clone(shellCommand);
definitions['taskDescription']['properties']['isShellCommand'] = Objects.clone(shellCommand);
definitions['taskRunnerConfiguration']['properties']['isShellCommand'] = Objects.clone(shellCommand);
definitions['commandConfiguration']['properties']['isShellCommand'] = Objects.deepClone(shellCommand);
definitions['taskDescription']['properties']['isShellCommand'] = Objects.deepClone(shellCommand);
definitions['taskRunnerConfiguration']['properties']['isShellCommand'] = Objects.deepClone(shellCommand);
Object.getOwnPropertyNames(definitions).forEach(key => {
let newKey = key + '1';
......@@ -101,4 +101,4 @@ ProblemMatcherRegistry.onReady().then(() => {
}
});
export default schema;
\ No newline at end of file
export default schema;
......@@ -101,7 +101,7 @@ const presentation: IJSONSchema = {
}
};
const terminal: IJSONSchema = Objects.clone(presentation);
const terminal: IJSONSchema = Objects.deepClone(presentation);
terminal.deprecationMessage = nls.localize('JsonSchema.tasks.terminal', 'The terminal property is deprecated. Use presentation instead');
const group: IJSONSchema = {
......@@ -178,8 +178,8 @@ let taskConfiguration: IJSONSchema = {
description: nls.localize('JsonSchema.tasks.taskName', 'The task\'s name'),
deprecationMessage: nls.localize('JsonSchema.tasks.taskName.deprecated', 'The task\'s name property is deprecated. Use the label property instead.')
},
identifier: Objects.clone(identifier),
group: Objects.clone(group),
identifier: Objects.deepClone(identifier),
group: Objects.deepClone(group),
isBackground: {
type: 'boolean',
description: nls.localize('JsonSchema.tasks.background', 'Whether the executed task is kept alive and is running in the background.'),
......@@ -190,7 +190,7 @@ let taskConfiguration: IJSONSchema = {
description: nls.localize('JsonSchema.tasks.promptOnClose', 'Whether the user is prompted when VS Code closes with a running task.'),
default: false
},
presentation: Objects.clone(presentation),
presentation: Objects.deepClone(presentation),
problemMatcher: {
$ref: '#/definitions/problemMatcherType',
description: nls.localize('JsonSchema.tasks.matchers', 'The problem matcher(s) to use. Can either be a string or a problem matcher definition or an array of strings and problem matchers.')
......@@ -201,7 +201,7 @@ let taskConfiguration: IJSONSchema = {
let taskDefinitions: IJSONSchema[] = [];
TaskDefinitionRegistry.onReady().then(() => {
for (let taskType of TaskDefinitionRegistry.all()) {
let schema: IJSONSchema = Objects.clone(taskConfiguration);
let schema: IJSONSchema = Objects.deepClone(taskConfiguration);
// Since we do this after the schema is assigned we need to patch the refs.
schema.properties.type = {
type: 'string',
......@@ -213,31 +213,31 @@ TaskDefinitionRegistry.onReady().then(() => {
}
for (let key of Object.keys(taskType.properties)) {
let property = taskType.properties[key];
schema.properties[key] = Objects.clone(property);
schema.properties[key] = Objects.deepClone(property);
}
fixReferences(schema);
taskDefinitions.push(schema);
}
});
let customize = Objects.clone(taskConfiguration);
let customize = Objects.deepClone(taskConfiguration);
customize.properties.customize = {
type: 'string',
deprecationMessage: nls.localize('JsonSchema.tasks.customize.deprecated', 'The customize property is deprecated. See the 1.14 release notes on how to migrate to the new task customization approach')
};
taskDefinitions.push(customize);
let definitions = Objects.clone(commonSchema.definitions);
let definitions = Objects.deepClone(commonSchema.definitions);
let taskDescription: IJSONSchema = definitions.taskDescription;
taskDescription.required = ['label'];
taskDescription.properties.label = Objects.clone(label);
taskDescription.properties.isShellCommand = Objects.clone(shellCommand);
taskDescription.properties.label = Objects.deepClone(label);
taskDescription.properties.isShellCommand = Objects.deepClone(shellCommand);
taskDescription.properties.dependsOn = dependsOn;
taskDescription.properties.identifier = Objects.clone(identifier);
taskDescription.properties.type = Objects.clone(taskType);
taskDescription.properties.presentation = Objects.clone(presentation);
taskDescription.properties.identifier = Objects.deepClone(identifier);
taskDescription.properties.type = Objects.deepClone(taskType);
taskDescription.properties.presentation = Objects.deepClone(presentation);
taskDescription.properties.terminal = terminal;
taskDescription.properties.group = Objects.clone(group);
taskDescription.properties.group = Objects.deepClone(group);
taskDescription.properties.taskName.deprecationMessage = nls.localize(
'JsonSchema.tasks.taskName.deprecated',
'The task\'s name property is deprecated. Use the label property instead.'
......@@ -278,15 +278,15 @@ tasks.items = {
oneOf: taskDefinitions
};
definitions.commandConfiguration.properties.isShellCommand = Objects.clone(shellCommand);
definitions.commandConfiguration.properties.isShellCommand = Objects.deepClone(shellCommand);
definitions.options.properties.shell = {
$ref: '#/definitions/shellConfiguration'
};
definitions.taskRunnerConfiguration.properties.isShellCommand = Objects.clone(shellCommand);
definitions.taskRunnerConfiguration.properties.type = Objects.clone(taskType);
definitions.taskRunnerConfiguration.properties.group = Objects.clone(group);
definitions.taskRunnerConfiguration.properties.presentation = Objects.clone(presentation);
definitions.taskRunnerConfiguration.properties.isShellCommand = Objects.deepClone(shellCommand);
definitions.taskRunnerConfiguration.properties.type = Objects.deepClone(taskType);
definitions.taskRunnerConfiguration.properties.group = Objects.deepClone(group);
definitions.taskRunnerConfiguration.properties.presentation = Objects.deepClone(presentation);
definitions.taskRunnerConfiguration.properties.suppressTaskName.deprecationMessage = nls.localize(
'JsonSchema.tasks.suppressTaskName.deprecated',
'The property suppressTaskName is deprecated. Inline the command with its arguments into the task instead. See also the 1.14 release notes.'
......@@ -296,11 +296,11 @@ definitions.taskRunnerConfiguration.properties.taskSelector.deprecationMessage =
'The property taskSelector is deprecated. Inline the command with its arguments into the task instead. See also the 1.14 release notes.'
);
let osSpecificTaskRunnerConfiguration = Objects.clone(definitions.taskRunnerConfiguration);
let osSpecificTaskRunnerConfiguration = Objects.deepClone(definitions.taskRunnerConfiguration);
delete osSpecificTaskRunnerConfiguration.properties.tasks;
osSpecificTaskRunnerConfiguration.additionalProperties = false;
definitions.osSpecificTaskRunnerConfiguration = osSpecificTaskRunnerConfiguration;
definitions.taskRunnerConfiguration.properties.version = Objects.clone(version);
definitions.taskRunnerConfiguration.properties.version = Objects.deepClone(version);
const schema: IJSONSchema = {
oneOf: [
......@@ -310,7 +310,7 @@ const schema: IJSONSchema = {
type: 'object',
required: ['version'],
properties: {
version: Objects.clone(version),
version: Objects.deepClone(version),
windows: {
'$ref': '#/definitions/osSpecificTaskRunnerConfiguration',
'description': nls.localize('JsonSchema.windows', 'Windows specific command configuration')
......@@ -352,4 +352,4 @@ ProblemMatcherRegistry.onReady().then(() => {
}
});
export default schema;
\ No newline at end of file
export default schema;
......@@ -1529,7 +1529,7 @@ class TaskService extends EventEmitter implements ITaskService {
if (!detectedConfig) {
return { workspaceFolder, config, hasErrors };
}
let result: TaskConfig.ExternalTaskRunnerConfiguration = Objects.clone(config);
let result: TaskConfig.ExternalTaskRunnerConfiguration = Objects.deepClone(config);
let configuredTasks: IStringDictionary<TaskConfig.CustomTask> = Object.create(null);
if (!result.tasks) {
if (detectedConfig.tasks) {
......@@ -1601,7 +1601,7 @@ class TaskService extends EventEmitter implements ITaskService {
private getConfiguration(workspaceFolder: IWorkspaceFolder): { config: TaskConfig.ExternalTaskRunnerConfiguration; hasParseErrors: boolean } {
let result = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY
? Objects.clone(this.configurationService.getValue<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri }))
? Objects.deepClone(this.configurationService.getValue<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri }))
: undefined;
if (!result) {
return { config: undefined, hasParseErrors: false };
......@@ -2419,4 +2419,4 @@ schema.oneOf = [...schemaVersion2.oneOf, ...schemaVersion1.oneOf];
let jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
jsonRegistry.registerSchema(schemaId, schema);
......@@ -607,7 +607,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
if (!matcher.filePrefix) {
result.push(matcher);
} else {
let copy = Objects.clone(matcher);
let copy = Objects.deepClone(matcher);
copy.filePrefix = this.resolveVariable(task, copy.filePrefix);
result.push(copy);
}
......@@ -717,4 +717,4 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
}
return 'other';
}
}
\ No newline at end of file
}
......@@ -218,7 +218,7 @@ export class ProcessRunnerDetector {
private resolveCommandOptions(workspaceFolder: IWorkspaceFolder, options: CommandOptions): CommandOptions {
// TODO@Dirk adopt new configuration resolver service https://github.com/Microsoft/vscode/issues/31365
let result = Objects.clone(options);
let result = Objects.deepClone(options);
if (result.cwd) {
result.cwd = this.configurationResolverService.resolve(workspaceFolder, result.cwd);
}
......
......@@ -390,7 +390,7 @@ export class ProcessTaskSystem extends EventEmitter implements ITaskSystem {
if (!matcher.filePrefix) {
result.push(matcher);
} else {
let copy = Objects.clone(matcher);
let copy = Objects.deepClone(matcher);
copy.filePrefix = this.resolveVariable(task, copy.filePrefix);
result.push(copy);
}
......
......@@ -519,7 +519,7 @@ function _fillDefaults<T>(this: void, target: T, defaults: T, properties: MetaDa
}
if (target === void 0 || target === null) {
if (defaults !== void 0 && defaults !== null) {
return Objects.clone(defaults);
return Objects.deepClone(defaults);
} else {
return undefined;
}
......@@ -631,7 +631,7 @@ namespace CommandOptions {
}
}
if (options.env !== void 0) {
result.env = Objects.clone(options.env);
result.env = Objects.deepClone(options.env);
}
result.shell = ShellConfiguration.from(options.shell, context);
return isEmpty(result) ? undefined : result;
......@@ -983,11 +983,11 @@ namespace ProblemMatcherConverter {
variableName = variableName.substring(1);
let global = ProblemMatcherRegistry.get(variableName);
if (global) {
return Objects.clone(global);
return Objects.deepClone(global);
}
let localProblemMatcher = context.namedProblemMatchers[variableName];
if (localProblemMatcher) {
localProblemMatcher = Objects.clone(localProblemMatcher);
localProblemMatcher = Objects.deepClone(localProblemMatcher);
// remove the name
delete localProblemMatcher.name;
return localProblemMatcher;
......@@ -1166,7 +1166,7 @@ namespace ConfiguringTask {
} else if (required.has(property)) {
let schema = properties[property];
if (schema.default !== void 0) {
identifier[property] = Objects.clone(schema.default);
identifier[property] = Objects.deepClone(schema.default);
} else {
switch (schema.type) {
case 'boolean':
......@@ -1910,4 +1910,4 @@ class VersionConverter {
}
}
*/
\ No newline at end of file
*/
......@@ -15,7 +15,7 @@ import { ITerminalConfiguration, ITerminalConfigHelper, ITerminalFont, IShellLau
import { TPromise } from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import { isFedora } from 'vs/workbench/parts/terminal/electron-browser/terminal';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
interface IEditorConfiguration {
editor: IEditorOptions;
......@@ -50,7 +50,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
}
public get config(): ITerminalConfiguration {
return clone(this._configurationService.getValue<IFullTerminalConfiguration>().terminal.integrated);
return deepClone(this._configurationService.getValue<IFullTerminalConfiguration>().terminal.integrated);
}
private _measureFont(fontFamily: string, fontSize: number, lineHeight: number): ITerminalFont {
......@@ -193,4 +193,4 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
}
return r;
}
}
\ No newline at end of file
}
......@@ -39,7 +39,7 @@ import { registerColor, focusBorder, textLinkForeground, textLinkActiveForegroun
import { getExtraColor } from 'vs/workbench/parts/welcome/walkThrough/node/walkThroughUtils';
import { UILabelProvider } from 'vs/base/common/keybindingLabels';
import { OS, OperatingSystem } from 'vs/base/common/platform';
import { clone } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
export const WALK_THROUGH_FOCUS = new RawContextKey<boolean>('interactivePlaygroundFocus', false);
......@@ -462,7 +462,7 @@ export class WalkThroughPart extends BaseEditor {
}
private getEditorOptions(language: string): IEditorOptions {
const config = clone(this.configurationService.getValue<IEditorOptions>('editor', { overrideIdentifier: language }));
const config = deepClone(this.configurationService.getValue<IEditorOptions>('editor', { overrideIdentifier: language }));
return {
...isObject(config) ? config : Object.create(null),
scrollBeyondLastLine: false,
......
......@@ -71,7 +71,7 @@ defaultConfigurationExtPoint.setHandler(extensions => {
registeredDefaultConfigurations = extensions.map(extension => {
const id = extension.description.id;
const name = extension.description.name;
const defaults = objects.clone(extension.value);
const defaults = objects.deepClone(extension.value);
return <IDefaultConfigurationExtension>{
id, name, defaults
};
......@@ -95,7 +95,7 @@ configurationExtPoint.setHandler(extensions => {
const configurations: IConfigurationNode[] = [];
function handleConfiguration(node: IConfigurationNode, id: string, extension: IExtensionPointUser<any>) {
let configuration = objects.clone(node);
let configuration = objects.deepClone(node);
if (configuration.title && (typeof configuration.title !== 'string')) {
extension.collector.error(nls.localize('invalid.title', "'configuration.title' must be a string"));
......@@ -209,4 +209,4 @@ jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
},
additionalProperties: false,
errorMessage: nls.localize('unknownWorkspaceProperty', "Unknown workspace configuration property")
});
\ No newline at end of file
});
......@@ -6,7 +6,7 @@
import nls = require('vs/nls');
import { onUnexpectedError } from 'vs/base/common/errors';
import { assign, clone } from 'vs/base/common/objects';
import { assign, deepClone } from 'vs/base/common/objects';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
......@@ -94,7 +94,7 @@ export class CrashReporterService implements ICrashReporterService {
});
// start crash reporter right here
crashReporter.start(clone(this.options));
crashReporter.start(deepClone(this.options));
// start crash reporter in the main process
return this.windowsService.startCrashReporter(this.options);
......@@ -119,7 +119,7 @@ export class CrashReporterService implements ICrashReporterService {
// Experimental crash reporting support for child processes on Mac only for now
if (this.isEnabled && isMacintosh) {
const childProcessOptions = clone(this.options);
const childProcessOptions = deepClone(this.options);
childProcessOptions.extra.processName = name;
childProcessOptions.crashesDirectory = os.tmpdir();
......@@ -128,4 +128,4 @@ export class CrashReporterService implements ICrashReporterService {
return void 0;
}
}
\ No newline at end of file
}
......@@ -136,7 +136,7 @@ export class ExtensionHostProcessWorker {
const port = data[1];
const opts = {
env: objects.mixin(objects.clone(process.env), {
env: objects.mixin(objects.deepClone(process.env), {
AMD_ENTRYPOINT: 'vs/workbench/node/extensionHostProcess',
PIPE_LOGGING: 'true',
VERBOSE_LOGGING: true,
......
......@@ -64,7 +64,7 @@ export class SearchService implements ISearchService {
// Configuration: File Excludes
if (!query.disregardExcludeSettings) {
const fileExcludes = objects.clone(configuration && configuration.files && configuration.files.exclude);
const fileExcludes = objects.deepClone(configuration && configuration.files && configuration.files.exclude);
if (fileExcludes) {
if (!query.excludePattern) {
query.excludePattern = fileExcludes;
......
......@@ -374,10 +374,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
}
private updateColorCustomizations(notify = true): void {
let newColorCustomizations = objects.clone(this.configurationService.getValue<IColorCustomizations>(CUSTOM_WORKBENCH_COLORS_SETTING)) || {};
let newColorCustomizations = objects.deepClone(this.configurationService.getValue<IColorCustomizations>(CUSTOM_WORKBENCH_COLORS_SETTING)) || {};
let newColorIds = Object.keys(newColorCustomizations);
let newTokenColorCustomizations = objects.clone(this.configurationService.getValue<ITokenColorCustomizations>(CUSTOM_EDITOR_COLORS_SETTING)) || {};
let newTokenColorCustomizations = objects.deepClone(this.configurationService.getValue<ITokenColorCustomizations>(CUSTOM_EDITOR_COLORS_SETTING)) || {};
if (this.hasCustomizationChanged(newColorCustomizations, newColorIds, newTokenColorCustomizations)) {
this.colorCustomizations = newColorCustomizations;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册