mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
first wiring of update-call, #1396
This commit is contained in:
@@ -4,29 +4,35 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
import {IWorkbenchConfigurationService} from 'vs/workbench/services/configuration/common/configuration';
|
||||
import {ExtHostContext, ExtHostConfigurationShape} from './extHost.protocol';
|
||||
import {IConfigurationEditingService, ConfigurationTarget, ConfigurationEditingResult} from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
import {MainThreadConfigurationShape, ExtHostContext} from './extHost.protocol';
|
||||
|
||||
export class MainThreadConfiguration {
|
||||
export class MainThreadConfiguration extends MainThreadConfigurationShape {
|
||||
|
||||
private _configurationService: IWorkbenchConfigurationService;
|
||||
private _configurationEditingService: IConfigurationEditingService;
|
||||
private _toDispose: IDisposable;
|
||||
private _proxy: ExtHostConfigurationShape;
|
||||
|
||||
constructor(
|
||||
@IConfigurationEditingService configurationEditingService: IConfigurationEditingService,
|
||||
@IWorkbenchConfigurationService configurationService: IWorkbenchConfigurationService,
|
||||
@IThreadService threadService: IThreadService
|
||||
) {
|
||||
this._configurationService = configurationService;
|
||||
this._proxy = threadService.get(ExtHostContext.ExtHostConfiguration);
|
||||
|
||||
this._toDispose = this._configurationService.onDidUpdateConfiguration(event => this._proxy.$acceptConfigurationChanged(event.config));
|
||||
this._proxy.$acceptConfigurationChanged(this._configurationService.getConfiguration());
|
||||
super();
|
||||
this._configurationEditingService = configurationEditingService;
|
||||
const proxy = threadService.get(ExtHostContext.ExtHostConfiguration);
|
||||
this._toDispose = configurationService.onDidUpdateConfiguration(event => proxy.$acceptConfigurationChanged(event.config));
|
||||
proxy.$acceptConfigurationChanged(configurationService.getConfiguration());
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
|
||||
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise<ConfigurationEditingResult> {
|
||||
return this._configurationEditingService.writeConfiguration(target, [{ key, value }]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user