mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
first wiring of update-call, #1396
This commit is contained in:
@@ -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());
|
||||
const extHostConfiguration = col.define(ExtHostContext.ExtHostConfiguration).set<ExtHostConfiguration>(new ExtHostConfiguration(threadService));
|
||||
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());
|
||||
|
||||
@@ -61,6 +61,7 @@ export class ExtHostContribution implements IWorkbenchContribution {
|
||||
// Addressable instances
|
||||
const col = new InstanceCollection();
|
||||
col.define(MainContext.MainThreadCommands).set(create(MainThreadCommands));
|
||||
col.define(MainContext.MainThreadConfiguration).set(create(MainThreadConfiguration));
|
||||
col.define(MainContext.MainThreadDiagnostics).set(create(MainThreadDiagnostics));
|
||||
col.define(MainContext.MainThreadDocuments).set(create(MainThreadDocuments));
|
||||
col.define(MainContext.MainThreadEditors).set(create(MainThreadEditors));
|
||||
|
||||
@@ -27,6 +27,8 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import {IResourceEdit} from 'vs/editor/common/services/bulkEdit';
|
||||
|
||||
import {ConfigurationTarget, ConfigurationEditingResult} from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
|
||||
import {IPickOpenEntry, IPickOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||
import {IWorkspaceSymbol} from 'vs/workbench/parts/search/common/search';
|
||||
import {TextEditorRevealType, ITextEditorConfigurationUpdate, IResolvedTextEditorConfiguration, ISelectionChangeEvent} from './mainThreadEditorsTracker';
|
||||
@@ -81,6 +83,10 @@ export abstract class MainThreadCommandsShape {
|
||||
$getCommands(): Thenable<string[]> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadConfigurationShape {
|
||||
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise<ConfigurationEditingResult> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadDiagnosticsShape {
|
||||
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any> { throw ni(); }
|
||||
$clear(owner: string): TPromise<any> { throw ni(); }
|
||||
@@ -290,6 +296,7 @@ export abstract class ExtHostQuickOpenShape {
|
||||
|
||||
export const MainContext = {
|
||||
MainThreadCommands: createMainId<MainThreadCommandsShape>('MainThreadCommands', MainThreadCommandsShape),
|
||||
MainThreadConfiguration: createMainId<MainThreadConfigurationShape>('MainThreadConfiguration', MainThreadConfigurationShape),
|
||||
MainThreadDiagnostics: createMainId<MainThreadDiagnosticsShape>('MainThreadDiagnostics', MainThreadDiagnosticsShape),
|
||||
MainThreadDocuments: createMainId<MainThreadDocumentsShape>('MainThreadDocuments', MainThreadDocumentsShape),
|
||||
MainThreadEditors: createMainId<MainThreadEditorsShape>('MainThreadEditors', MainThreadEditorsShape),
|
||||
|
||||
@@ -8,16 +8,19 @@ import {clone} 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} from './extHost.protocol';
|
||||
import {ExtHostConfigurationShape, MainContext, MainThreadConfigurationShape} from './extHost.protocol';
|
||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
|
||||
export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
|
||||
private _config: any;
|
||||
private _proxy: MainThreadConfigurationShape;
|
||||
private _hasConfig: boolean;
|
||||
private _config: any;
|
||||
private _onDidChangeConfiguration: Emitter<void>;
|
||||
|
||||
constructor() {
|
||||
constructor(threadService: IThreadService) {
|
||||
super();
|
||||
this._proxy = threadService.get(MainContext.MainThreadConfiguration);
|
||||
this._onDidChangeConfiguration = new Emitter<void>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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