提交 7ac6d551 编写于 作者: B Benjamin Pasero

make sure to return clones for configurationservice#lookup()

上级 19bf8e0f
......@@ -73,10 +73,11 @@ export class ConfigurationService<T> implements IConfigurationService, IDisposab
}
public lookup<C>(key: string): IConfigurationValue<C> {
// make sure to clone the configuration so that the receiver does not tamper with the values
return {
default: getConfigurationValue<C>(getDefaultValues(), key),
user: getConfigurationValue<C>(flatten(this.rawConfig.getConfig()), key),
value: getConfigurationValue<C>(this.getConfiguration(), key)
default: objects.clone(getConfigurationValue<C>(getDefaultValues(), key)),
user: objects.clone(getConfigurationValue<C>(flatten(this.rawConfig.getConfig()), key)),
value: objects.clone(getConfigurationValue<C>(this.getConfiguration(), key))
};
}
......
......@@ -125,23 +125,13 @@ export class WorkspaceConfigurationService implements IWorkspaceConfigurationSer
}
public reloadConfiguration(section?: string): TPromise<any> {
const previousConfig = this.getConfiguration();
// Reset caches to ensure we are hitting the disk
this.bulkFetchFromWorkspacePromise = null;
this.workspaceFilePathToConfiguration = Object.create(null);
// Load configuration
return this.baseConfigurationService.reloadConfiguration().then(() => this.doLoadConfiguration(section).then(res => {
// Since we reload the configuration, we also check for changes and emit an event in case the config changed
const currentConfig = this.getConfiguration();
if (!objects.equals(previousConfig, currentConfig)) {
this._onDidUpdateConfiguration.fire({ config: currentConfig });
}
return res;
}));
return this.baseConfigurationService.reloadConfiguration().then(() => this.doLoadConfiguration(section));
}
private doLoadConfiguration(section?: string): TPromise<any> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册