提交 09f19a92 编写于 作者: D Don Jayamanne

reverted changes made to #8042, inadverted checkin (need to create a pull request instead)

上级 c6e27312
......@@ -130,7 +130,7 @@ export abstract class AbstractSystemVariables implements ISystemVariables {
public resolve(value: IStringDictionary<IStringDictionary<string>>): IStringDictionary<IStringDictionary<string>>;
public resolve(value: any): any {
if (Types.isString(value)) {
return this.resolveString(value);
return this.__resolveString(value);
} else if (Types.isArray(value)) {
return this.__resolveArray(value);
} else if (Types.isObject(value)) {
......@@ -143,7 +143,7 @@ export abstract class AbstractSystemVariables implements ISystemVariables {
resolveAny<T>(value: T): T;
resolveAny<T>(value: any): any {
if (Types.isString(value)) {
return this.resolveString(value);
return this.__resolveString(value);
} else if (Types.isArray(value)) {
return this.__resolveAnyArray(value);
} else if (Types.isObject(value)) {
......@@ -153,7 +153,7 @@ export abstract class AbstractSystemVariables implements ISystemVariables {
return value;
}
protected resolveString(value: string): string {
private __resolveString(value: string): string {
let regexp = /\$\{(.*?)\}/g;
return value.replace(regexp, (match: string, name: string) => {
let newValue = (<any>this)[name];
......@@ -185,7 +185,7 @@ export abstract class AbstractSystemVariables implements ISystemVariables {
}
private __resolveArray(value: string[]): string[] {
return value.map(s => this.resolveString(s));
return value.map(s => this.__resolveString(s));
}
private __resolveAnyArray<T>(value: T[]): T[];
......
......@@ -30,7 +30,6 @@ import { Adapter } from 'vs/workbench/parts/debug/node/debugAdapter';
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { SettingsVariables } from 'vs/workbench/parts/lib/node/settingsVariables';
// debuggers extension point
......@@ -156,7 +155,6 @@ export class ConfigurationManager implements debug.IConfigurationManager {
public configuration: debug.IConfig;
private systemVariables: SystemVariables;
private settingsVariables: SettingsVariables;
private adapters: Adapter[];
private allModeIdsForBreakpoints: { [key: string]: boolean };
private _onDidConfigurationChange: Emitter<string>;
......@@ -173,7 +171,6 @@ export class ConfigurationManager implements debug.IConfigurationManager {
) {
this._onDidConfigurationChange = new Emitter<string>();
this.systemVariables = this.contextService.getWorkspace() ? new SystemVariables(this.editorService, this.contextService) : null;
this.settingsVariables = new SettingsVariables(this.configurationService.getConfiguration<any>());
this.setConfiguration(configName);
this.adapters = [];
this.registerListeners();
......@@ -329,12 +326,6 @@ export class ConfigurationManager implements debug.IConfigurationManager {
this.configuration[key] = this.systemVariables.resolveAny(this.configuration[key]);
});
}
// massage configuration attributes - substitute settings (from settings.json) variables.
if (this.systemVariables) {
Object.keys(this.configuration).forEach(key => {
this.configuration[key] = this.settingsVariables.resolveAny(this.configuration[key]);
});
}
}
}).then(() => this._onDidConfigurationChange.fire(this.configurationName));
}
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { AbstractSystemVariables } from 'vs/base/common/parsers';
export class SettingsVariables extends AbstractSystemVariables {
constructor(private configuration:any) {
super();
}
protected resolveString(value: string): string {
let regexp = /\${settings.(.+)}/g;
return value.replace(regexp, (match: string, name: string) => {
return new Function('_', 'return _.' + name)(this.configuration);
});
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册