tests around #update, #1396

This commit is contained in:
Johannes Rieken
2016-08-25 16:00:04 +02:00
parent 45f1593479
commit 6c99282d08
3 changed files with 76 additions and 7 deletions

View File

@@ -102,7 +102,7 @@ export class ExtHostAPIImplementation {
const extHostDocuments = col.define(ExtHostContext.ExtHostDocuments).set<ExtHostDocuments>(new ExtHostDocuments(threadService));
const extHostEditors = col.define(ExtHostContext.ExtHostEditors).set<ExtHostEditors>(new ExtHostEditors(threadService, extHostDocuments));
const extHostCommands = col.define(ExtHostContext.ExtHostCommands).set<ExtHostCommands>(new ExtHostCommands(threadService, extHostEditors));
const extHostConfiguration = col.define(ExtHostContext.ExtHostConfiguration).set<ExtHostConfiguration>(new ExtHostConfiguration(threadService));
const extHostConfiguration = col.define(ExtHostContext.ExtHostConfiguration).set<ExtHostConfiguration>(new ExtHostConfiguration(threadService.get(MainContext.MainThreadConfiguration)));
const extHostDiagnostics = col.define(ExtHostContext.ExtHostDiagnostics).set<ExtHostDiagnostics>(new ExtHostDiagnostics(threadService));
const languageFeatures = col.define(ExtHostContext.ExtHostLanguageFeatures).set<ExtHostLanguageFeatures>(new ExtHostLanguageFeatures(threadService, extHostDocuments, extHostCommands, extHostDiagnostics));
const extHostFileSystemEvent = col.define(ExtHostContext.ExtHostFileSystemEventService).set<ExtHostFileSystemEventService>(new ExtHostFileSystemEventService());

View File

@@ -8,8 +8,7 @@ import {mixin} from 'vs/base/common/objects';
import {illegalState} from 'vs/base/common/errors';
import Event, {Emitter} from 'vs/base/common/event';
import {WorkspaceConfiguration} from 'vscode';
import {ExtHostConfigurationShape, MainContext, MainThreadConfigurationShape} from './extHost.protocol';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostConfigurationShape, MainThreadConfigurationShape} from './extHost.protocol';
import {ConfigurationTarget, ConfigurationEditingResult} from 'vs/workbench/services/configuration/common/configurationEditing';
export class ExtHostConfiguration extends ExtHostConfigurationShape {
@@ -17,12 +16,11 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
private _proxy: MainThreadConfigurationShape;
private _hasConfig: boolean;
private _config: any;
private _onDidChangeConfiguration: Emitter<void>;
private _onDidChangeConfiguration = new Emitter<void>();
constructor(threadService: IThreadService) {
constructor(proxy: MainThreadConfigurationShape) {
super();
this._proxy = threadService.get(MainContext.MainThreadConfiguration);
this._onDidChangeConfiguration = new Emitter<void>();
this._proxy = proxy;
}
get onDidChangeConfiguration(): Event<void> {
@@ -56,6 +54,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
return result;
},
update: (key: string, value: any, global: boolean) => {
key = section ? `${section}.${key}` : key;
const target = global ? ConfigurationTarget.USER : ConfigurationTarget.WORKSPACE;
return this._proxy.$updateConfigurationOption(target, key, value).then(value => {
if (value !== ConfigurationEditingResult.OK) {