diff --git a/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts b/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts index 84ab4e8113b..257382a9330 100644 --- a/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts +++ b/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts @@ -14,30 +14,24 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions'; import { ExtHostCustomersRegistry } from "vs/workbench/api/electron-browser/extHostCustomers"; // --- addressable -import { MainThreadConfiguration } from './mainThreadConfiguration'; -import { MainThreadDebugService } from './mainThreadDebugService'; import { MainThreadDiagnostics } from './mainThreadDiagnostics'; import { MainThreadDocuments } from './mainThreadDocuments'; import { MainThreadDocumentContentProviders } from './mainThreadDocumentContentProviders'; import { MainThreadEditors } from './mainThreadEditors'; import { MainThreadErrors } from './mainThreadErrors'; import { MainThreadTreeViews } from './mainThreadTreeViews'; -import { MainThreadLanguageFeatures } from './mainThreadLanguageFeatures'; import { MainThreadLanguages } from './mainThreadLanguages'; import { MainThreadMessageService } from './mainThreadMessageService'; import { MainThreadOutputService } from './mainThreadOutputService'; import { MainThreadProgress } from './mainThreadProgress'; -import { MainThreadQuickOpen } from './mainThreadQuickOpen'; import { MainThreadStatusBar } from './mainThreadStatusBar'; import { MainThreadStorage } from './mainThreadStorage'; import { MainThreadTelemetry } from './mainThreadTelemetry'; import { MainThreadTerminalService } from './mainThreadTerminalService'; import { MainThreadWorkspace } from './mainThreadWorkspace'; import { MainProcessExtensionServiceAPI } from './mainThreadExtensionService'; -import { MainThreadFileSystemEventService } from './mainThreadFileSystemEventService'; import { MainThreadTask } from './mainThreadTask'; import { MainThreadSCM } from './mainThreadSCM'; -import { MainThreadCredentials } from './mainThreadCredentials'; // --- other interested parties import { MainThreadDocumentsAndEditors } from './mainThreadDocumentsAndEditors'; @@ -51,9 +45,9 @@ import './mainThreadHeapService'; // --- mainThread participants import './mainThreadCommands'; -// import './mainThreadConfiguration'; -// import './mainThreadCredentials'; -// import './mainThreadDebugService'; +import './mainThreadConfiguration'; +import './mainThreadCredentials'; +import './mainThreadDebugService'; // import './mainThreadDiagnostics'; // import './mainThreadDocuments'; // import './mainThreadDocumentsAndEditors'; @@ -61,14 +55,14 @@ import './mainThreadEditor'; // import './mainThreadEditors'; // import './mainThreadErrors'; // import './mainThreadExtensionService'; -// import './mainThreadFileSystemEventService'; +import './mainThreadFileSystemEventService'; // import './mainThreadHeapService'; -// import './mainThreadLanguageFeatures'; +import './mainThreadLanguageFeatures'; // import './mainThreadLanguages'; // import './mainThreadMessageService'; // import './mainThreadOutputService'; // import './mainThreadProgress'; -// import './mainThreadQuickOpen'; +import './mainThreadQuickOpen'; // import './mainThreadSCM'; // import './mainThreadSaveParticipant'; // import './mainThreadStatusBar'; @@ -102,20 +96,16 @@ export class ExtHostContribution implements IWorkbenchContribution { // Addressable instances const col = new InstanceCollection(); - col.define(MainContext.MainThreadConfiguration).set(create(MainThreadConfiguration)); - col.define(MainContext.MainThreadDebugService).set(create(MainThreadDebugService)); col.define(MainContext.MainThreadDiagnostics).set(create(MainThreadDiagnostics)); col.define(MainContext.MainThreadDocumentContentProviders).set(create(MainThreadDocumentContentProviders)); col.define(MainContext.MainThreadDocuments).set(this.instantiationService.createInstance(MainThreadDocuments, documentsAndEditors)); col.define(MainContext.MainThreadEditors).set(this.instantiationService.createInstance(MainThreadEditors, documentsAndEditors)); col.define(MainContext.MainThreadErrors).set(create(MainThreadErrors)); col.define(MainContext.MainThreadTreeViews).set(create(MainThreadTreeViews)); - col.define(MainContext.MainThreadLanguageFeatures).set(create(MainThreadLanguageFeatures)); col.define(MainContext.MainThreadLanguages).set(create(MainThreadLanguages)); col.define(MainContext.MainThreadMessageService).set(create(MainThreadMessageService)); col.define(MainContext.MainThreadOutputService).set(create(MainThreadOutputService)); col.define(MainContext.MainThreadProgress).set(create(MainThreadProgress)); - col.define(MainContext.MainThreadQuickOpen).set(create(MainThreadQuickOpen)); col.define(MainContext.MainThreadStatusBar).set(create(MainThreadStatusBar)); col.define(MainContext.MainThreadStorage).set(create(MainThreadStorage)); col.define(MainContext.MainThreadTelemetry).set(create(MainThreadTelemetry)); @@ -123,7 +113,6 @@ export class ExtHostContribution implements IWorkbenchContribution { col.define(MainContext.MainThreadWorkspace).set(create(MainThreadWorkspace)); col.define(MainContext.MainThreadSCM).set(create(MainThreadSCM)); col.define(MainContext.MainThreadTask).set(create(MainThreadTask)); - col.define(MainContext.MainThreadCredentials).set(create(MainThreadCredentials)); col.define(MainContext.MainProcessExtensionService).set(create(MainProcessExtensionServiceAPI)); // Registered named customers @@ -147,7 +136,6 @@ export class ExtHostContribution implements IWorkbenchContribution { create(JSONValidationExtensionPoint); // TODO@rehost: can survive an ext host restart create(ColorExtensionPoint); // TODO@rehost: can survive an ext host restart this.instantiationService.createInstance(LanguageConfigurationFileHandler); // TODO@rehost: can survive an ext host restart - create(MainThreadFileSystemEventService); create(SaveParticipant); } } diff --git a/src/vs/workbench/api/electron-browser/mainThreadCommands.ts b/src/vs/workbench/api/electron-browser/mainThreadCommands.ts index 2cc372223a0..9dfaa7e7530 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadCommands.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadCommands.ts @@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { ExtHostContext, MainThreadCommandsShape, ExtHostCommandsShape, MainContext, IExtHostContext } from '../node/extHost.protocol'; import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; -@extHostNamedCustomer(MainContext.MainThreadCommands) +@extHostNamedCustomer(MainContext.MainThreadCommands) export class MainThreadCommands extends MainThreadCommandsShape { private readonly _disposables = new Map(); diff --git a/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts b/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts index fd8d794be99..e303de4a9c2 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts @@ -7,24 +7,25 @@ import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration'; import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing'; -import { MainThreadConfigurationShape, ExtHostContext } from '../node/extHost.protocol'; +import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostContext } from '../node/extHost.protocol'; +import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostNamedCustomer(MainContext.MainThreadConfiguration) export class MainThreadConfiguration extends MainThreadConfigurationShape { private readonly _configurationEditingService: IConfigurationEditingService; private readonly _configurationListener: IDisposable; constructor( + extHostContext: IExtHostContext, @IConfigurationEditingService configurationEditingService: IConfigurationEditingService, - @IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService, - @IThreadService threadService: IThreadService + @IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService ) { super(); this._configurationEditingService = configurationEditingService; - const proxy = threadService.get(ExtHostContext.ExtHostConfiguration); + const proxy = extHostContext.get(ExtHostContext.ExtHostConfiguration); this._configurationListener = configurationService.onDidUpdateConfiguration(() => { proxy.$acceptConfigurationChanged(configurationService.getConfigurationData()); diff --git a/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts b/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts index cdf72936e20..fad21233b2e 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts @@ -4,17 +4,24 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; -import { ExtHostContext, MainThreadCredentialsShape, ExtHostCredentialsShape } from '../node/extHost.protocol'; +import { ExtHostContext, MainThreadCredentialsShape, ExtHostCredentialsShape, MainContext, IExtHostContext } from '../node/extHost.protocol'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; +import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostNamedCustomer(MainContext.MainThreadCredentials) export class MainThreadCredentials extends MainThreadCredentialsShape { private _proxy: ExtHostCredentialsShape; - constructor( @IThreadService threadService: IThreadService, @ICredentialsService private _credentialsService: ICredentialsService) { + constructor( + extHostContext: IExtHostContext, + @ICredentialsService private _credentialsService: ICredentialsService + ) { super(); - this._proxy = threadService.get(ExtHostContext.ExtHostCredentials); + this._proxy = extHostContext.get(ExtHostContext.ExtHostCredentials); + } + + public dispose(): void { } $readSecret(service: string, account: string): Thenable { diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index 8e378f115b7..a6895402e4b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -7,22 +7,23 @@ import URI from 'vs/base/common/uri'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDebugService, IConfig } from 'vs/workbench/parts/debug/common/debug'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; import { TPromise } from 'vs/base/common/winjs.base'; -import { ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, DebugSessionUUID } from '../node/extHost.protocol'; +import { ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, DebugSessionUUID, MainContext, IExtHostContext } from '../node/extHost.protocol'; +import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostNamedCustomer(MainContext.MainThreadDebugService) export class MainThreadDebugService extends MainThreadDebugServiceShape { private _proxy: ExtHostDebugServiceShape; private _toDispose: IDisposable[]; constructor( - @IThreadService threadService: IThreadService, + extHostContext: IExtHostContext, @IDebugService private debugService: IDebugService ) { super(); - this._proxy = threadService.get(ExtHostContext.ExtHostDebugService); + this._proxy = extHostContext.get(ExtHostContext.ExtHostDebugService); this._toDispose = []; this._toDispose.push(debugService.onDidNewProcess(proc => this._proxy.$acceptDebugSessionStarted(proc.getId(), proc.configuration.type, proc.getName(false)))); this._toDispose.push(debugService.onDidEndProcess(proc => this._proxy.$acceptDebugSessionTerminated(proc.getId(), proc.configuration.type, proc.getName(false)))); diff --git a/src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts b/src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts index 08bda384b6f..e270208fd2e 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts @@ -5,20 +5,21 @@ 'use strict'; import { FileChangeType, IFileService } from 'vs/platform/files/common/files'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; -import { ExtHostContext, ExtHostFileSystemEventServiceShape, FileSystemEvents } from '../node/extHost.protocol'; +import { ExtHostContext, ExtHostFileSystemEventServiceShape, FileSystemEvents, IExtHostContext } from '../node/extHost.protocol'; import { IDisposable } from "vs/base/common/lifecycle"; +import { extHostCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostCustomer export class MainThreadFileSystemEventService { private readonly _listener: IDisposable; constructor( - @IThreadService threadService: IThreadService, + extHostContext: IExtHostContext, @IFileService fileService: IFileService ) { - const proxy: ExtHostFileSystemEventServiceShape = threadService.get(ExtHostContext.ExtHostFileSystemEventService); + const proxy: ExtHostFileSystemEventServiceShape = extHostContext.get(ExtHostContext.ExtHostFileSystemEventService); const events: FileSystemEvents = { created: [], changed: [], diff --git a/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts index d3557ec1d11..cd3cd3eed6b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts @@ -7,7 +7,6 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { IDisposable } from 'vs/base/common/lifecycle'; import { Emitter } from 'vs/base/common/event'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; import * as vscode from 'vscode'; import { IReadOnlyModel, ISingleEditOperation } from 'vs/editor/common/editorCommon'; import * as modes from 'vs/editor/common/modes'; @@ -16,13 +15,15 @@ import { wireCancellationToken } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Position as EditorPosition } from 'vs/editor/common/core/position'; import { Range as EditorRange } from 'vs/editor/common/core/range'; -import { ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, IRawColorFormatMap } from '../node/extHost.protocol'; +import { ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, IRawColorFormatMap, MainContext, IExtHostContext } from '../node/extHost.protocol'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { LanguageConfiguration } from 'vs/editor/common/modes/languageConfiguration'; import { IHeapService } from './mainThreadHeapService'; import { IModeService } from 'vs/editor/common/services/modeService'; import { ColorFormatter, CombinedColorFormatter } from 'vs/editor/contrib/colorPicker/common/colorFormatter'; +import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostNamedCustomer(MainContext.MainThreadLanguageFeatures) export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape { private _proxy: ExtHostLanguageFeaturesShape; @@ -32,12 +33,12 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape private _formatters: Map; constructor( - @IThreadService threadService: IThreadService, + extHostContext: IExtHostContext, @IHeapService heapService: IHeapService, @IModeService modeService: IModeService, ) { super(); - this._proxy = threadService.get(ExtHostContext.ExtHostLanguageFeatures); + this._proxy = extHostContext.get(ExtHostContext.ExtHostLanguageFeatures); this._heapService = heapService; this._modeService = modeService; this._formatters = new Map(); diff --git a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts index 6475757bb8d..7c7c56b072a 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts @@ -6,11 +6,12 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { asWinJsPromise } from 'vs/base/common/async'; -import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; import { IQuickOpenService, IPickOptions, IInputOptions } from 'vs/platform/quickOpen/common/quickOpen'; import { InputBoxOptions } from 'vscode'; -import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems } from '../node/extHost.protocol'; +import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems, MainContext, IExtHostContext } from '../node/extHost.protocol'; +import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; +@extHostNamedCustomer(MainContext.MainThreadQuickOpen) export class MainThreadQuickOpen extends MainThreadQuickOpenShape { private _proxy: ExtHostQuickOpenShape; @@ -21,14 +22,17 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape { private _token: number = 0; constructor( - @IThreadService threadService: IThreadService, + extHostContext: IExtHostContext, @IQuickOpenService quickOpenService: IQuickOpenService ) { super(); - this._proxy = threadService.get(ExtHostContext.ExtHostQuickOpen); + this._proxy = extHostContext.get(ExtHostContext.ExtHostQuickOpen); this._quickOpenService = quickOpenService; } + public dispose(): void { + } + $show(options: IPickOptions): TPromise { const myToken = ++this._token; diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index a84623db500..6112cb9adc3 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -131,6 +131,7 @@ function ni() { return new Error('Not implemented'); } // --- main thread export abstract class MainThreadCommandsShape { + dispose(): void { throw ni(); } $registerCommand(id: string): TPromise { throw ni(); } $unregisterCommand(id: string): TPromise { throw ni(); } $executeCommand(id: string, args: any[]): Thenable { throw ni(); } @@ -138,6 +139,7 @@ export abstract class MainThreadCommandsShape { } export abstract class MainThreadConfigurationShape { + dispose(): void { throw ni(); } $updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resource: URI): TPromise { throw ni(); } $removeConfigurationOption(target: ConfigurationTarget, key: string, resource: URI): TPromise { throw ni(); } } @@ -228,6 +230,7 @@ export abstract class MainThreadErrorsShape { } export abstract class MainThreadLanguageFeaturesShape { + dispose(): void { throw ni(); } $unregister(handle: number): TPromise { throw ni(); } $registerOutlineSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } $registerCodeLensSupport(handle: number, selector: vscode.DocumentSelector, eventHandle: number): TPromise { throw ni(); } @@ -287,6 +290,7 @@ export interface MyQuickPickItems extends IPickOpenEntry { handle: number; } export abstract class MainThreadQuickOpenShape { + dispose(): void { throw ni(); } $show(options: IPickOptions): TPromise { throw ni(); } $setItems(items: MyQuickPickItems[]): TPromise { throw ni(); } $setError(error: Error): TPromise { throw ni(); } @@ -367,12 +371,14 @@ export abstract class MainThreadSCMShape { export type DebugSessionUUID = string; export abstract class MainThreadDebugServiceShape { + dispose(): void { throw ni(); } $startDebugging(folderUri: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise { throw ni(); } $startDebugSession(folderUri: URI | undefined, config: vscode.DebugConfiguration): TPromise { throw ni(); } $customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise { throw ni(); } } export abstract class MainThreadCredentialsShape { + dispose(): void { throw ni(); } $readSecret(service: string, account: string): Thenable { throw ni(); } $writeSecret(service: string, account: string, secret: string): Thenable { throw ni(); } $deleteSecret(service: string, account: string): Thenable { throw ni(); } diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index 38f0a099cc7..87937e29740 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -125,7 +125,7 @@ suite('ExtHostLanguageFeatureCommands', function () { extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, heapService, diagnostics); threadService.set(ExtHostContext.ExtHostLanguageFeatures, extHost); - mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures)); + mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures, threadService)); threadService.sync().then(done, done); }); diff --git a/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts b/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts index e87a45cecad..ed935effd4d 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts @@ -114,7 +114,7 @@ suite('ExtHostLanguageFeatures', function () { extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, heapService, diagnostics); threadService.set(ExtHostContext.ExtHostLanguageFeatures, extHost); - mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures)); + mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures, threadService)); }); suiteTeardown(() => {