This commit is contained in:
Sandeep Somavarapu
2018-02-13 11:34:56 +01:00
parent 10f4d56212
commit f965a2c51e
4 changed files with 14 additions and 20 deletions

View File

@@ -41,14 +41,14 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
private readonly _onDidChangeConfiguration = new Emitter<vscode.ConfigurationChangeEvent>();
private readonly _proxy: MainThreadConfigurationShape;
private readonly _extHostWorkspace: ExtHostWorkspace;
private _configurationScopes: Map<string, ConfigurationScope>;
private _configurationScopes: { [key: string]: ConfigurationScope };
private _configuration: Configuration;
constructor(proxy: MainThreadConfigurationShape, extHostWorkspace: ExtHostWorkspace, data: IConfigurationInitData) {
this._proxy = proxy;
this._extHostWorkspace = extHostWorkspace;
this._configuration = Configuration.parse(data);
this._readConfigurationScopes(data.configurationScopes);
this._configurationScopes = data.configurationScopes;
}
get onDidChangeConfiguration(): Event<vscode.ConfigurationChangeEvent> {
@@ -129,7 +129,7 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
}
private _validateConfigurationAccess(key: string, resource: URI, extensionId: string): void {
const scope = this._configurationScopes.get(key);
const scope = this._configurationScopes[key];
const extensionIdText = extensionId ? `[${extensionId}] ` : '';
if (ConfigurationScope.RESOURCE === scope) {
if (resource === void 0) {
@@ -145,18 +145,6 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
}
}
private _readConfigurationScopes(scopes: ConfigurationScope[]): void {
this._configurationScopes = new Map<string, ConfigurationScope>();
if (scopes.length) {
const defaultKeys = this._configuration.keys(this._extHostWorkspace.workspace).default;
if (defaultKeys.length === scopes.length) {
for (let i = 0; i < defaultKeys.length; i++) {
this._configurationScopes.set(defaultKeys[i], scopes[i]);
}
}
}
}
private _toConfigurationChangeEvent(data: IWorkspaceConfigurationChangeEventData): vscode.ConfigurationChangeEvent {
const changedConfiguration = new ConfigurationModel(data.changedConfiguration.contents, data.changedConfiguration.keys, data.changedConfiguration.overrides);
const changedConfigurationByResource: StrictResourceMap<ConfigurationModel> = new StrictResourceMap<ConfigurationModel>();