diff --git a/src/vs/workbench/api/electron-browser/mainThreadCommands.ts b/src/vs/workbench/api/electron-browser/mainThreadCommands.ts index 9dfaa7e7530..8d24bab4469 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadCommands.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadCommands.ts @@ -11,8 +11,8 @@ 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) -export class MainThreadCommands extends MainThreadCommandsShape { +@extHostNamedCustomer(MainContext.MainThreadCommands) +export class MainThreadCommands implements MainThreadCommandsShape { private readonly _disposables = new Map(); private readonly _proxy: ExtHostCommandsShape; @@ -21,7 +21,6 @@ export class MainThreadCommands extends MainThreadCommandsShape { extHostContext: IExtHostContext, @ICommandService private readonly _commandService: ICommandService, ) { - super(); this._proxy = extHostContext.get(ExtHostContext.ExtHostCommands); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts b/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts index e303de4a9c2..5acd5fbc363 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts @@ -13,7 +13,7 @@ import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostCont import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; @extHostNamedCustomer(MainContext.MainThreadConfiguration) -export class MainThreadConfiguration extends MainThreadConfigurationShape { +export class MainThreadConfiguration implements MainThreadConfigurationShape { private readonly _configurationEditingService: IConfigurationEditingService; private readonly _configurationListener: IDisposable; @@ -23,7 +23,6 @@ export class MainThreadConfiguration extends MainThreadConfigurationShape { @IConfigurationEditingService configurationEditingService: IConfigurationEditingService, @IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService ) { - super(); this._configurationEditingService = configurationEditingService; const proxy = extHostContext.get(ExtHostContext.ExtHostConfiguration); diff --git a/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts b/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts index fad21233b2e..24fc9ad9572 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadCredentials.ts @@ -9,7 +9,7 @@ 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 { +export class MainThreadCredentials implements MainThreadCredentialsShape { private _proxy: ExtHostCredentialsShape; @@ -17,7 +17,6 @@ export class MainThreadCredentials extends MainThreadCredentialsShape { extHostContext: IExtHostContext, @ICredentialsService private _credentialsService: ICredentialsService ) { - super(); this._proxy = extHostContext.get(ExtHostContext.ExtHostCredentials); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index a6895402e4b..08227ef91e9 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -12,7 +12,7 @@ import { ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; @extHostNamedCustomer(MainContext.MainThreadDebugService) -export class MainThreadDebugService extends MainThreadDebugServiceShape { +export class MainThreadDebugService implements MainThreadDebugServiceShape { private _proxy: ExtHostDebugServiceShape; private _toDispose: IDisposable[]; @@ -21,8 +21,6 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape { extHostContext: IExtHostContext, @IDebugService private debugService: IDebugService ) { - super(); - 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)))); diff --git a/src/vs/workbench/api/electron-browser/mainThreadDiagnostics.ts b/src/vs/workbench/api/electron-browser/mainThreadDiagnostics.ts index a7e5e47b5fc..f6fcb4be571 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDiagnostics.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDiagnostics.ts @@ -9,13 +9,12 @@ import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { MainThreadDiagnosticsShape } from '../node/extHost.protocol'; -export class MainThreadDiagnostics extends MainThreadDiagnosticsShape { +export class MainThreadDiagnostics implements MainThreadDiagnosticsShape { private readonly _activeOwners = new Set(); private readonly _markerService: IMarkerService; constructor( @IMarkerService markerService: IMarkerService) { - super(); this._markerService = markerService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts b/src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts index 57d6fc15e48..35f030be5b6 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts @@ -17,7 +17,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; -export class MainThreadDocumentContentProviders extends MainThreadDocumentContentProvidersShape { +export class MainThreadDocumentContentProviders implements MainThreadDocumentContentProvidersShape { private _resourceContentProvider: { [handle: number]: IDisposable } = Object.create(null); private readonly _proxy: ExtHostDocumentContentProvidersShape; @@ -30,7 +30,6 @@ export class MainThreadDocumentContentProviders extends MainThreadDocumentConten @ICodeEditorService codeEditorService: ICodeEditorService, @IEditorGroupService editorGroupService: IEditorGroupService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostDocumentContentProviders); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadDocuments.ts b/src/vs/workbench/api/electron-browser/mainThreadDocuments.ts index 6c149c7546c..474f6e7fc4f 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDocuments.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDocuments.ts @@ -64,7 +64,7 @@ export class BoundModelReferenceCollection { } } -export class MainThreadDocuments extends MainThreadDocumentsShape { +export class MainThreadDocuments implements MainThreadDocumentsShape { private _modelService: IModelService; private _modeService: IModeService; @@ -89,7 +89,6 @@ export class MainThreadDocuments extends MainThreadDocumentsShape { @ITextModelService textModelResolverService: ITextModelService, @IUntitledEditorService untitledEditorService: IUntitledEditorService, ) { - super(); this._modelService = modelService; this._modeService = modeService; this._textModelResolverService = textModelResolverService; diff --git a/src/vs/workbench/api/electron-browser/mainThreadEditors.ts b/src/vs/workbench/api/electron-browser/mainThreadEditors.ts index 8536472b94d..29621db99d4 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadEditors.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadEditors.ts @@ -23,7 +23,7 @@ import { ExtHostContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextDocum import { IRange } from 'vs/editor/common/core/range'; import { ISelection } from 'vs/editor/common/core/selection'; -export class MainThreadEditors extends MainThreadEditorsShape { +export class MainThreadEditors implements MainThreadEditorsShape { private _proxy: ExtHostEditorsShape; private _documentsAndEditors: MainThreadDocumentsAndEditors; @@ -41,7 +41,6 @@ export class MainThreadEditors extends MainThreadEditorsShape { @IEditorGroupService editorGroupService: IEditorGroupService, @ITelemetryService telemetryService: ITelemetryService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostEditors); this._documentsAndEditors = documentsAndEditors; this._workbenchEditorService = workbenchEditorService; diff --git a/src/vs/workbench/api/electron-browser/mainThreadErrors.ts b/src/vs/workbench/api/electron-browser/mainThreadErrors.ts index ca8962bc1f4..e1920e5ed05 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadErrors.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadErrors.ts @@ -7,7 +7,7 @@ import * as errors from 'vs/base/common/errors'; import { MainThreadErrorsShape } from '../node/extHost.protocol'; -export class MainThreadErrors extends MainThreadErrorsShape { +export class MainThreadErrors implements MainThreadErrorsShape { public onUnexpectedExtHostError(err: any): void { errors.onUnexpectedError(err); diff --git a/src/vs/workbench/api/electron-browser/mainThreadExtensionService.ts b/src/vs/workbench/api/electron-browser/mainThreadExtensionService.ts index 451dc780ffc..4b514103d20 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadExtensionService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadExtensionService.ts @@ -9,13 +9,11 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions'; import { MainProcessExtensionServiceShape } from '../node/extHost.protocol'; import { ExtensionService } from "vs/workbench/services/extensions/electron-browser/extensionService"; -export class MainProcessExtensionServiceAPI extends MainProcessExtensionServiceShape { +export class MainProcessExtensionServiceAPI implements MainProcessExtensionServiceShape { private readonly _extensionService: ExtensionService; constructor( @IExtensionService extensionService: IExtensionService) { - super(); - if (extensionService instanceof ExtensionService) { this._extensionService = extensionService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts index cd3cd3eed6b..69d2f6c878f 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts @@ -24,7 +24,7 @@ import { ColorFormatter, CombinedColorFormatter } from 'vs/editor/contrib/colorP import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; @extHostNamedCustomer(MainContext.MainThreadLanguageFeatures) -export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape { +export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape { private _proxy: ExtHostLanguageFeaturesShape; private _heapService: IHeapService; @@ -37,7 +37,6 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape @IHeapService heapService: IHeapService, @IModeService modeService: IModeService, ) { - super(); this._proxy = extHostContext.get(ExtHostContext.ExtHostLanguageFeatures); this._heapService = heapService; this._modeService = modeService; diff --git a/src/vs/workbench/api/electron-browser/mainThreadLanguages.ts b/src/vs/workbench/api/electron-browser/mainThreadLanguages.ts index a80c17c54f9..164674984e1 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadLanguages.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadLanguages.ts @@ -8,14 +8,13 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { IModeService } from 'vs/editor/common/services/modeService'; import { MainThreadLanguagesShape } from '../node/extHost.protocol'; -export class MainThreadLanguages extends MainThreadLanguagesShape { +export class MainThreadLanguages implements MainThreadLanguagesShape { private _modeService: IModeService; constructor( @IModeService modeService: IModeService ) { - super(); this._modeService = modeService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts b/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts index b821c9eda45..04361f50fb0 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts @@ -12,13 +12,12 @@ import { TPromise as Promise } from 'vs/base/common/winjs.base'; import { MainThreadMessageServiceShape } from '../node/extHost.protocol'; import * as vscode from 'vscode'; -export class MainThreadMessageService extends MainThreadMessageServiceShape { +export class MainThreadMessageService implements MainThreadMessageServiceShape { constructor( @IMessageService private _messageService: IMessageService, @IChoiceService private _choiceService: IChoiceService ) { - super(); } $showMessage(severity: Severity, message: string, options: vscode.MessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable { diff --git a/src/vs/workbench/api/electron-browser/mainThreadOutputService.ts b/src/vs/workbench/api/electron-browser/mainThreadOutputService.ts index 93e532a348c..e034fb37994 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadOutputService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadOutputService.ts @@ -11,7 +11,7 @@ import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { MainThreadOutputServiceShape } from '../node/extHost.protocol'; -export class MainThreadOutputService extends MainThreadOutputServiceShape { +export class MainThreadOutputService implements MainThreadOutputServiceShape { private readonly _outputService: IOutputService; private readonly _partService: IPartService; @@ -22,7 +22,6 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape { @IPartService partService: IPartService, @IPanelService panelService: IPanelService ) { - super(); this._outputService = outputService; this._partService = partService; this._panelService = panelService; diff --git a/src/vs/workbench/api/electron-browser/mainThreadProgress.ts b/src/vs/workbench/api/electron-browser/mainThreadProgress.ts index 86e75c62868..2336c354e73 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadProgress.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadProgress.ts @@ -8,7 +8,7 @@ import { IProgressService2, IProgress, IProgressOptions, IProgressStep } from 'v import { TPromise } from 'vs/base/common/winjs.base'; import { MainThreadProgressShape } from '../node/extHost.protocol'; -export class MainThreadProgress extends MainThreadProgressShape { +export class MainThreadProgress implements MainThreadProgressShape { private _progressService: IProgressService2; private _progress = new Map }>(); @@ -16,7 +16,6 @@ export class MainThreadProgress extends MainThreadProgressShape { constructor( @IProgressService2 progressService: IProgressService2 ) { - super(); this._progressService = progressService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts index 7c7c56b072a..dedf92498b0 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts @@ -12,7 +12,7 @@ import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuic import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers"; @extHostNamedCustomer(MainContext.MainThreadQuickOpen) -export class MainThreadQuickOpen extends MainThreadQuickOpenShape { +export class MainThreadQuickOpen implements MainThreadQuickOpenShape { private _proxy: ExtHostQuickOpenShape; private _quickOpenService: IQuickOpenService; @@ -25,7 +25,6 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape { extHostContext: IExtHostContext, @IQuickOpenService quickOpenService: IQuickOpenService ) { - super(); this._proxy = extHostContext.get(ExtHostContext.ExtHostQuickOpen); this._quickOpenService = quickOpenService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadSCM.ts b/src/vs/workbench/api/electron-browser/mainThreadSCM.ts index f7d231fd607..55064be1fad 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSCM.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSCM.ts @@ -205,7 +205,7 @@ class MainThreadSCMProvider implements ISCMProvider { } } -export class MainThreadSCM extends MainThreadSCMShape { +export class MainThreadSCM implements MainThreadSCMShape { private _proxy: ExtHostSCMShape; private _sourceControls: { [handle: number]: MainThreadSCMProvider; } = Object.create(null); @@ -218,7 +218,6 @@ export class MainThreadSCM extends MainThreadSCMShape { @ISCMService private scmService: ISCMService, @ICommandService private commandService: ICommandService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostSCM); this.scmService.onDidChangeProvider(this.onDidChangeProvider, this, this._disposables); diff --git a/src/vs/workbench/api/electron-browser/mainThreadStatusBar.ts b/src/vs/workbench/api/electron-browser/mainThreadStatusBar.ts index d6f8b022136..7b64701d2b7 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadStatusBar.ts @@ -9,14 +9,13 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import { MainThreadStatusBarShape } from '../node/extHost.protocol'; import { ThemeColor } from 'vs/platform/theme/common/themeService'; -export class MainThreadStatusBar extends MainThreadStatusBarShape { +export class MainThreadStatusBar implements MainThreadStatusBarShape { private readonly _entries: { [id: number]: IDisposable }; constructor( @IStatusbarService private readonly _statusbarService: IStatusbarService ) { - super(); this._entries = Object.create(null); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadStorage.ts b/src/vs/workbench/api/electron-browser/mainThreadStorage.ts index 5f109ae9c3d..c528570eb67 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadStorage.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadStorage.ts @@ -8,12 +8,11 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { MainThreadStorageShape } from '../node/extHost.protocol'; -export class MainThreadStorage extends MainThreadStorageShape { +export class MainThreadStorage implements MainThreadStorageShape { private _storageService: IStorageService; constructor( @IStorageService storageService: IStorageService) { - super(); this._storageService = storageService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadTask.ts b/src/vs/workbench/api/electron-browser/mainThreadTask.ts index bbd8040c9c5..06169740d53 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTask.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTask.ts @@ -11,12 +11,11 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape } from '../node/extHost.protocol'; -export class MainThreadTask extends MainThreadTaskShape { +export class MainThreadTask implements MainThreadTaskShape { private _proxy: ExtHostTaskShape; constructor( @IThreadService threadService: IThreadService, @ITaskService private _taskService: ITaskService) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostTask); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadTelemetry.ts b/src/vs/workbench/api/electron-browser/mainThreadTelemetry.ts index 42a15120c40..8f09a063dc4 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTelemetry.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTelemetry.ts @@ -11,12 +11,11 @@ import { MainThreadTelemetryShape } from '../node/extHost.protocol'; /** * Helper always instantiated in the main process to receive telemetry events from remote telemetry services */ -export class MainThreadTelemetry extends MainThreadTelemetryShape { +export class MainThreadTelemetry implements MainThreadTelemetryShape { private _telemetryService: ITelemetryService; constructor( @ITelemetryService telemetryService: ITelemetryService) { - super(); this._telemetryService = telemetryService; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts index 4c60bd2407e..a26433d233b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts @@ -10,7 +10,7 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic import { TPromise } from 'vs/base/common/winjs.base'; import { ExtHostContext, ExtHostTerminalServiceShape, MainThreadTerminalServiceShape } from '../node/extHost.protocol'; -export class MainThreadTerminalService extends MainThreadTerminalServiceShape { +export class MainThreadTerminalService implements MainThreadTerminalServiceShape { private _proxy: ExtHostTerminalServiceShape; private _toDispose: IDisposable[]; @@ -19,7 +19,6 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape { @IThreadService threadService: IThreadService, @ITerminalService private terminalService: ITerminalService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostTerminalService); this._toDispose = []; this._toDispose.push(terminalService.onInstanceDisposed((terminalInstance) => this._onTerminalDisposed(terminalInstance))); diff --git a/src/vs/workbench/api/electron-browser/mainThreadTreeViews.ts b/src/vs/workbench/api/electron-browser/mainThreadTreeViews.ts index 931470c63e5..66522b0a4c0 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTreeViews.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTreeViews.ts @@ -12,7 +12,7 @@ import { IMessageService, Severity } from 'vs/platform/message/common/message'; import { ViewsRegistry } from 'vs/workbench/parts/views/browser/viewsRegistry'; import { ITreeViewDataProvider, ITreeItem, TreeItemCollapsibleState } from 'vs/workbench/parts/views/common/views'; -export class MainThreadTreeViews extends MainThreadTreeViewsShape { +export class MainThreadTreeViews implements MainThreadTreeViewsShape { private _proxy: ExtHostTreeViewsShape; @@ -20,7 +20,6 @@ export class MainThreadTreeViews extends MainThreadTreeViewsShape { @IThreadService threadService: IThreadService, @IMessageService private messageService: IMessageService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostTreeViews); } diff --git a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts index ff08df00bba..924b7f4c4ef 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts @@ -22,7 +22,7 @@ import { RemoteFileService, IRemoteFileSystemProvider } from 'vs/workbench/servi import { Emitter } from 'vs/base/common/event'; -export class MainThreadWorkspace extends MainThreadWorkspaceShape { +export class MainThreadWorkspace implements MainThreadWorkspaceShape { private readonly _toDispose: IDisposable[] = []; private readonly _activeSearches: { [id: number]: TPromise } = Object.create(null); @@ -37,7 +37,6 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape { @IFileService private readonly _fileService: IFileService, @IThreadService threadService: IThreadService ) { - super(); this._proxy = threadService.get(ExtHostContext.ExtHostWorkspace); this._contextService.onDidChangeWorkspaceRoots(this._onDidChangeWorkspace, this, this._toDispose); } diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 6112cb9adc3..725deb61dce 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -126,39 +126,37 @@ export class InstanceCollection { } } -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(); } - $getCommands(): Thenable { throw ni(); } +export interface MainThreadCommandsShape { + dispose(): void; + $registerCommand(id: string): TPromise; + $unregisterCommand(id: string): TPromise; + $executeCommand(id: string, args: any[]): Thenable; + $getCommands(): Thenable; } -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(); } +export interface MainThreadConfigurationShape { + dispose(): void; + $updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resource: URI): TPromise; + $removeConfigurationOption(target: ConfigurationTarget, key: string, resource: URI): TPromise; } -export abstract class MainThreadDiagnosticsShape { - $changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise { throw ni(); } - $clear(owner: string): TPromise { throw ni(); } +export interface MainThreadDiagnosticsShape { + $changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise; + $clear(owner: string): TPromise; } -export abstract class MainThreadDocumentContentProvidersShape { - $registerTextContentProvider(handle: number, scheme: string): void { throw ni(); } - $unregisterTextContentProvider(handle: number): void { throw ni(); } - $onVirtualDocumentChange(uri: URI, value: ITextSource): void { throw ni(); } +export interface MainThreadDocumentContentProvidersShape { + $registerTextContentProvider(handle: number, scheme: string): void; + $unregisterTextContentProvider(handle: number): void; + $onVirtualDocumentChange(uri: URI, value: ITextSource): void; } -export abstract class MainThreadDocumentsShape { - $tryCreateDocument(options?: { language?: string; content?: string; }): TPromise { throw ni(); } - $tryOpenDocument(uri: URI): TPromise { throw ni(); } - $trySaveDocument(uri: URI): TPromise { throw ni(); } +export interface MainThreadDocumentsShape { + $tryCreateDocument(options?: { language?: string; content?: string; }): TPromise; + $tryOpenDocument(uri: URI): TPromise; + $trySaveDocument(uri: URI): TPromise; } export interface ISelectionChangeEvent { @@ -205,131 +203,131 @@ export interface ITextDocumentShowOptions { selection?: IRange; } -export abstract class MainThreadEditorsShape { - $tryShowTextDocument(resource: URI, options: ITextDocumentShowOptions): TPromise { throw ni(); } - $registerTextEditorDecorationType(key: string, options: editorCommon.IDecorationRenderOptions): void { throw ni(); } - $removeTextEditorDecorationType(key: string): void { throw ni(); } - $tryShowEditor(id: string, position: EditorPosition): TPromise { throw ni(); } - $tryHideEditor(id: string): TPromise { throw ni(); } - $trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise { throw ni(); } - $trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): TPromise { throw ni(); } - $tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise { throw ni(); } - $trySetSelections(id: string, selections: ISelection[]): TPromise { throw ni(); } - $tryApplyEdits(id: string, modelVersionId: number, edits: editorCommon.ISingleEditOperation[], opts: IApplyEditsOptions): TPromise { throw ni(); } - $tryInsertSnippet(id: string, template: string, selections: IRange[], opts: IUndoStopOptions): TPromise { throw ni(); } - $getDiffInformation(id: string): TPromise { throw ni(); } +export interface MainThreadEditorsShape { + $tryShowTextDocument(resource: URI, options: ITextDocumentShowOptions): TPromise; + $registerTextEditorDecorationType(key: string, options: editorCommon.IDecorationRenderOptions): void; + $removeTextEditorDecorationType(key: string): void; + $tryShowEditor(id: string, position: EditorPosition): TPromise; + $tryHideEditor(id: string): TPromise; + $trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise; + $trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): TPromise; + $tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise; + $trySetSelections(id: string, selections: ISelection[]): TPromise; + $tryApplyEdits(id: string, modelVersionId: number, edits: editorCommon.ISingleEditOperation[], opts: IApplyEditsOptions): TPromise; + $tryInsertSnippet(id: string, template: string, selections: IRange[], opts: IUndoStopOptions): TPromise; + $getDiffInformation(id: string): TPromise; } -export abstract class MainThreadTreeViewsShape { - $registerView(treeViewId: string): void { throw ni(); } - $refresh(treeViewId: string, treeItemHandles: number[]): void { throw ni(); } +export interface MainThreadTreeViewsShape { + $registerView(treeViewId: string): void; + $refresh(treeViewId: string, treeItemHandles: number[]): void; } -export abstract class MainThreadErrorsShape { - onUnexpectedExtHostError(err: any): void { throw ni(); } +export interface MainThreadErrorsShape { + onUnexpectedExtHostError(err: any): void; } -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(); } - $emitCodeLensEvent(eventHandle: number, event?: any): TPromise { throw ni(); } - $registerDeclaractionSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerImplementationSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerTypeDefinitionSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerHoverProvider(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerDocumentHighlightProvider(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerReferenceSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerDocumentFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerRangeFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerOnTypeFormattingSupport(handle: number, selector: vscode.DocumentSelector, autoFormatTriggerCharacters: string[]): TPromise { throw ni(); } - $registerNavigateTypeSupport(handle: number): TPromise { throw ni(); } - $registerRenameSupport(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[]): TPromise { throw ni(); } - $registerSignatureHelpProvider(handle: number, selector: vscode.DocumentSelector, triggerCharacter: string[]): TPromise { throw ni(); } - $registerDocumentLinkProvider(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $registerColorFormats(formats: IRawColorFormatMap): TPromise { throw ni(); } - $registerDocumentColorProvider(handle: number, selector: vscode.DocumentSelector): TPromise { throw ni(); } - $setLanguageConfiguration(handle: number, languageId: string, configuration: vscode.LanguageConfiguration): TPromise { throw ni(); } +export interface MainThreadLanguageFeaturesShape { + dispose(): void; + $unregister(handle: number): TPromise; + $registerOutlineSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerCodeLensSupport(handle: number, selector: vscode.DocumentSelector, eventHandle: number): TPromise; + $emitCodeLensEvent(eventHandle: number, event?: any): TPromise; + $registerDeclaractionSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerImplementationSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerTypeDefinitionSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerHoverProvider(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerDocumentHighlightProvider(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerReferenceSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerDocumentFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerRangeFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerOnTypeFormattingSupport(handle: number, selector: vscode.DocumentSelector, autoFormatTriggerCharacters: string[]): TPromise; + $registerNavigateTypeSupport(handle: number): TPromise; + $registerRenameSupport(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[]): TPromise; + $registerSignatureHelpProvider(handle: number, selector: vscode.DocumentSelector, triggerCharacter: string[]): TPromise; + $registerDocumentLinkProvider(handle: number, selector: vscode.DocumentSelector): TPromise; + $registerColorFormats(formats: IRawColorFormatMap): TPromise; + $registerDocumentColorProvider(handle: number, selector: vscode.DocumentSelector): TPromise; + $setLanguageConfiguration(handle: number, languageId: string, configuration: vscode.LanguageConfiguration): TPromise; } -export abstract class MainThreadLanguagesShape { - $getLanguages(): TPromise { throw ni(); } +export interface MainThreadLanguagesShape { + $getLanguages(): TPromise; } -export abstract class MainThreadMessageServiceShape { - $showMessage(severity: Severity, message: string, options: vscode.MessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable { throw ni(); } +export interface MainThreadMessageServiceShape { + $showMessage(severity: Severity, message: string, options: vscode.MessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable; } -export abstract class MainThreadOutputServiceShape { - $append(channelId: string, label: string, value: string): TPromise { throw ni(); } - $clear(channelId: string, label: string): TPromise { throw ni(); } - $dispose(channelId: string, label: string): TPromise { throw ni(); } - $reveal(channelId: string, label: string, preserveFocus: boolean): TPromise { throw ni(); } - $close(channelId: string): TPromise { throw ni(); } +export interface MainThreadOutputServiceShape { + $append(channelId: string, label: string, value: string): TPromise; + $clear(channelId: string, label: string): TPromise; + $dispose(channelId: string, label: string): TPromise; + $reveal(channelId: string, label: string, preserveFocus: boolean): TPromise; + $close(channelId: string): TPromise; } -export abstract class MainThreadProgressShape { +export interface MainThreadProgressShape { - $startProgress(handle: number, options: IProgressOptions): void { throw ni(); }; - $progressReport(handle: number, message: IProgressStep): void { throw ni(); } - $progressEnd(handle: number): void { throw ni(); } + $startProgress(handle: number, options: IProgressOptions): void; + $progressReport(handle: number, message: IProgressStep): void; + $progressEnd(handle: number): void; } -export abstract class MainThreadTerminalServiceShape { - $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], waitOnExit?: boolean): TPromise { throw ni(); } - $dispose(terminalId: number): void { throw ni(); } - $hide(terminalId: number): void { throw ni(); } - $sendText(terminalId: number, text: string, addNewLine: boolean): void { throw ni(); } - $show(terminalId: number, preserveFocus: boolean): void { throw ni(); } +export interface MainThreadTerminalServiceShape { + $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], waitOnExit?: boolean): TPromise; + $dispose(terminalId: number): void; + $hide(terminalId: number): void; + $sendText(terminalId: number, text: string, addNewLine: boolean): void; + $show(terminalId: number, preserveFocus: boolean): void; } 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(); } - $input(options: vscode.InputBoxOptions, validateInput: boolean): TPromise { throw ni(); } +export interface MainThreadQuickOpenShape { + dispose(): void; + $show(options: IPickOptions): TPromise; + $setItems(items: MyQuickPickItems[]): TPromise; + $setError(error: Error): TPromise; + $input(options: vscode.InputBoxOptions, validateInput: boolean): TPromise; } -export abstract class MainThreadStatusBarShape { - $setEntry(id: number, extensionId: string, text: string, tooltip: string, command: string, color: string | ThemeColor, alignment: MainThreadStatusBarAlignment, priority: number): void { throw ni(); } - $dispose(id: number) { throw ni(); } +export interface MainThreadStatusBarShape { + $setEntry(id: number, extensionId: string, text: string, tooltip: string, command: string, color: string | ThemeColor, alignment: MainThreadStatusBarAlignment, priority: number): void; + $dispose(id: number); } -export abstract class MainThreadStorageShape { - $getValue(shared: boolean, key: string): TPromise { throw ni(); } - $setValue(shared: boolean, key: string, value: any): TPromise { throw ni(); } +export interface MainThreadStorageShape { + $getValue(shared: boolean, key: string): TPromise; + $setValue(shared: boolean, key: string, value: any): TPromise; } -export abstract class MainThreadTelemetryShape { - $publicLog(eventName: string, data?: any): void { throw ni(); } - $getTelemetryInfo(): TPromise { throw ni(); } +export interface MainThreadTelemetryShape { + $publicLog(eventName: string, data?: any): void; + $getTelemetryInfo(): TPromise; } -export abstract class MainThreadWorkspaceShape { - $startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable { throw ni(); } - $cancelSearch(requestId: number): Thenable { throw ni(); } - $saveAll(includeUntitled?: boolean): Thenable { throw ni(); } - $applyWorkspaceEdit(edits: IResourceEdit[]): TPromise { throw ni(); } - $registerFileSystemProvider(handle: number, authority: string): void { throw ni(); } - $onFileSystemChange(handle: number, resource: URI): void { throw ni(); } +export interface MainThreadWorkspaceShape { + $startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable; + $cancelSearch(requestId: number): Thenable; + $saveAll(includeUntitled?: boolean): Thenable; + $applyWorkspaceEdit(edits: IResourceEdit[]): TPromise; + $registerFileSystemProvider(handle: number, authority: string): void; + $onFileSystemChange(handle: number, resource: URI): void; } -export abstract class MainThreadTaskShape { - $registerTaskProvider(handle: number): TPromise { throw ni(); } - $unregisterTaskProvider(handle: number): TPromise { throw ni(); } +export interface MainThreadTaskShape { + $registerTaskProvider(handle: number): TPromise; + $unregisterTaskProvider(handle: number): TPromise; } -export abstract class MainProcessExtensionServiceShape { - $localShowMessage(severity: Severity, msg: string): void { throw ni(); } - $onExtensionActivated(extensionId: string): void { throw ni(); } - $onExtensionActivationFailed(extensionId: string): void { throw ni(); } +export interface MainProcessExtensionServiceShape { + $localShowMessage(severity: Severity, msg: string): void; + $onExtensionActivated(extensionId: string): void; + $onExtensionActivationFailed(extensionId: string): void; } export interface SCMProviderFeatures { @@ -354,53 +352,53 @@ export type SCMRawResource = [ boolean /*faded*/ ]; -export abstract class MainThreadSCMShape { - $registerSourceControl(handle: number, id: string, label: string): void { throw ni(); } - $updateSourceControl(handle: number, features: SCMProviderFeatures): void { throw ni(); } - $unregisterSourceControl(handle: number): void { throw ni(); } +export interface MainThreadSCMShape { + $registerSourceControl(handle: number, id: string, label: string): void; + $updateSourceControl(handle: number, features: SCMProviderFeatures): void; + $unregisterSourceControl(handle: number): void; - $registerGroup(sourceControlHandle: number, handle: number, id: string, label: string): void { throw ni(); } - $updateGroup(sourceControlHandle: number, handle: number, features: SCMGroupFeatures): void { throw ni(); } - $updateGroupLabel(sourceControlHandle: number, handle: number, label: string): void { throw ni(); } - $updateGroupResourceStates(sourceControlHandle: number, groupHandle: number, resources: SCMRawResource[]): void { throw ni(); } - $unregisterGroup(sourceControlHandle: number, handle: number): void { throw ni(); } + $registerGroup(sourceControlHandle: number, handle: number, id: string, label: string): void; + $updateGroup(sourceControlHandle: number, handle: number, features: SCMGroupFeatures): void; + $updateGroupLabel(sourceControlHandle: number, handle: number, label: string): void; + $updateGroupResourceStates(sourceControlHandle: number, groupHandle: number, resources: SCMRawResource[]): void; + $unregisterGroup(sourceControlHandle: number, handle: number): void; - $setInputBoxValue(value: string): void { throw ni(); } + $setInputBoxValue(value: string): void; } 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 interface MainThreadDebugServiceShape { + dispose(): void; + $startDebugging(folderUri: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise; + $startDebugSession(folderUri: URI | undefined, config: vscode.DebugConfiguration): TPromise; + $customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise; } -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(); } +export interface MainThreadCredentialsShape { + dispose(): void; + $readSecret(service: string, account: string): Thenable; + $writeSecret(service: string, account: string, secret: string): Thenable; + $deleteSecret(service: string, account: string): Thenable; } // -- extension host -export abstract class ExtHostCommandsShape { - $executeContributedCommand(id: string, ...args: any[]): Thenable { throw ni(); } - $getContributedCommandHandlerDescriptions(): TPromise<{ [id: string]: string | ICommandHandlerDescription }> { throw ni(); } +export interface ExtHostCommandsShape { + $executeContributedCommand(id: string, ...args: any[]): Thenable; + $getContributedCommandHandlerDescriptions(): TPromise<{ [id: string]: string | ICommandHandlerDescription }>; } -export abstract class ExtHostConfigurationShape { - $acceptConfigurationChanged(data: IConfigurationData) { throw ni(); } +export interface ExtHostConfigurationShape { + $acceptConfigurationChanged(data: IConfigurationData); } -export abstract class ExtHostDiagnosticsShape { +export interface ExtHostDiagnosticsShape { } -export abstract class ExtHostDocumentContentProvidersShape { - $provideTextDocumentContent(handle: number, uri: URI): TPromise { throw ni(); } +export interface ExtHostDocumentContentProvidersShape { + $provideTextDocumentContent(handle: number, uri: URI): TPromise; } export interface IModelAddedData { @@ -411,15 +409,15 @@ export interface IModelAddedData { modeId: string; isDirty: boolean; } -export abstract class ExtHostDocumentsShape { - $acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void { throw ni(); } - $acceptModelSaved(strURL: string): void { throw ni(); } - $acceptDirtyStateChanged(strURL: string, isDirty: boolean): void { throw ni(); } - $acceptModelChanged(strURL: string, e: IModelChangedEvent, isDirty: boolean): void { throw ni(); } +export interface ExtHostDocumentsShape { + $acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void; + $acceptModelSaved(strURL: string): void; + $acceptDirtyStateChanged(strURL: string, isDirty: boolean): void; + $acceptModelChanged(strURL: string, e: IModelChangedEvent, isDirty: boolean): void; } -export abstract class ExtHostDocumentSaveParticipantShape { - $participateInSave(resource: URI, reason: SaveReason): TPromise { throw ni(); } +export interface ExtHostDocumentSaveParticipantShape { + $participateInSave(resource: URI, reason: SaveReason): TPromise; } export interface ITextEditorAddData { @@ -432,10 +430,10 @@ export interface ITextEditorAddData { export interface ITextEditorPositionData { [id: string]: EditorPosition; } -export abstract class ExtHostEditorsShape { - $acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void { throw ni(); } - $acceptSelectionsChanged(id: string, event: ISelectionChangeEvent): void { throw ni(); } - $acceptEditorPositionData(data: ITextEditorPositionData): void { throw ni(); } +export interface ExtHostEditorsShape { + $acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void; + $acceptSelectionsChanged(id: string, event: ISelectionChangeEvent): void; + $acceptEditorPositionData(data: ITextEditorPositionData): void; } export interface IDocumentsAndEditorsDelta { @@ -446,23 +444,23 @@ export interface IDocumentsAndEditorsDelta { newActiveEditor?: string; } -export abstract class ExtHostDocumentsAndEditorsShape { - $acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void { throw ni(); } +export interface ExtHostDocumentsAndEditorsShape { + $acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void; } -export abstract class ExtHostTreeViewsShape { - $getElements(treeViewId: string): TPromise { throw ni(); } - $getChildren(treeViewId: string, treeItemHandle: number): TPromise { throw ni(); } +export interface ExtHostTreeViewsShape { + $getElements(treeViewId: string): TPromise; + $getChildren(treeViewId: string, treeItemHandle: number): TPromise; } -export abstract class ExtHostWorkspaceShape { - $acceptWorkspaceData(workspace: IWorkspaceData): void { throw ni(); } - $resolveFile(handle: number, resource: URI): TPromise { throw ni(); } - $storeFile(handle: number, resource: URI, content: string): TPromise { throw ni(); } +export interface ExtHostWorkspaceShape { + $acceptWorkspaceData(workspace: IWorkspaceData): void; + $resolveFile(handle: number, resource: URI): TPromise; + $storeFile(handle: number, resource: URI, content: string): TPromise; } -export abstract class ExtHostExtensionServiceShape { - $activateByEvent(activationEvent: string): TPromise { throw ni(); } +export interface ExtHostExtensionServiceShape { + $activateByEvent(activationEvent: string): TPromise; } export interface FileSystemEvents { @@ -470,8 +468,8 @@ export interface FileSystemEvents { changed: URI[]; deleted: URI[]; } -export abstract class ExtHostFileSystemEventServiceShape { - $onFileEvent(events: FileSystemEvents) { throw ni(); } +export interface ExtHostFileSystemEventServiceShape { + $onFileEvent(events: FileSystemEvents); } export interface ObjectIdentifier { @@ -489,8 +487,8 @@ export namespace ObjectIdentifier { } } -export abstract class ExtHostHeapServiceShape { - $onGarbageCollection(ids: number[]): void { throw ni(); } +export interface ExtHostHeapServiceShape { + $onGarbageCollection(ids: number[]): void; } export interface IRawColorInfo { color: [number, number, number, number]; @@ -500,110 +498,110 @@ export interface IRawColorInfo { export type IRawColorFormatMap = [number, string][]; -export abstract class ExtHostLanguageFeaturesShape { - $provideDocumentSymbols(handle: number, resource: URI): TPromise { throw ni(); } - $provideCodeLenses(handle: number, resource: URI): TPromise { throw ni(); } - $resolveCodeLens(handle: number, resource: URI, symbol: modes.ICodeLensSymbol): TPromise { throw ni(); } - $provideDefinition(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideImplementation(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideTypeDefinition(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideHover(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideDocumentHighlights(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideReferences(handle: number, resource: URI, position: IPosition, context: modes.ReferenceContext): TPromise { throw ni(); } - $provideCodeActions(handle: number, resource: URI, range: IRange): TPromise { throw ni(); } - $provideDocumentFormattingEdits(handle: number, resource: URI, options: modes.FormattingOptions): TPromise { throw ni(); } - $provideDocumentRangeFormattingEdits(handle: number, resource: URI, range: IRange, options: modes.FormattingOptions): TPromise { throw ni(); } - $provideOnTypeFormattingEdits(handle: number, resource: URI, position: IPosition, ch: string, options: modes.FormattingOptions): TPromise { throw ni(); } - $provideWorkspaceSymbols(handle: number, search: string): TPromise { throw ni(); } - $resolveWorkspaceSymbol(handle: number, symbol: modes.SymbolInformation): TPromise { throw ni(); } - $provideRenameEdits(handle: number, resource: URI, position: IPosition, newName: string): TPromise { throw ni(); } - $provideCompletionItems(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $resolveCompletionItem(handle: number, resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise { throw ni(); } - $provideSignatureHelp(handle: number, resource: URI, position: IPosition): TPromise { throw ni(); } - $provideDocumentLinks(handle: number, resource: URI): TPromise { throw ni(); } - $provideDocumentColors(handle: number, resource: URI): TPromise { throw ni(); } - $resolveDocumentLink(handle: number, link: modes.ILink): TPromise { throw ni(); } +export interface ExtHostLanguageFeaturesShape { + $provideDocumentSymbols(handle: number, resource: URI): TPromise; + $provideCodeLenses(handle: number, resource: URI): TPromise; + $resolveCodeLens(handle: number, resource: URI, symbol: modes.ICodeLensSymbol): TPromise; + $provideDefinition(handle: number, resource: URI, position: IPosition): TPromise; + $provideImplementation(handle: number, resource: URI, position: IPosition): TPromise; + $provideTypeDefinition(handle: number, resource: URI, position: IPosition): TPromise; + $provideHover(handle: number, resource: URI, position: IPosition): TPromise; + $provideDocumentHighlights(handle: number, resource: URI, position: IPosition): TPromise; + $provideReferences(handle: number, resource: URI, position: IPosition, context: modes.ReferenceContext): TPromise; + $provideCodeActions(handle: number, resource: URI, range: IRange): TPromise; + $provideDocumentFormattingEdits(handle: number, resource: URI, options: modes.FormattingOptions): TPromise; + $provideDocumentRangeFormattingEdits(handle: number, resource: URI, range: IRange, options: modes.FormattingOptions): TPromise; + $provideOnTypeFormattingEdits(handle: number, resource: URI, position: IPosition, ch: string, options: modes.FormattingOptions): TPromise; + $provideWorkspaceSymbols(handle: number, search: string): TPromise; + $resolveWorkspaceSymbol(handle: number, symbol: modes.SymbolInformation): TPromise; + $provideRenameEdits(handle: number, resource: URI, position: IPosition, newName: string): TPromise; + $provideCompletionItems(handle: number, resource: URI, position: IPosition): TPromise; + $resolveCompletionItem(handle: number, resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise; + $provideSignatureHelp(handle: number, resource: URI, position: IPosition): TPromise; + $provideDocumentLinks(handle: number, resource: URI): TPromise; + $provideDocumentColors(handle: number, resource: URI): TPromise; + $resolveDocumentLink(handle: number, link: modes.ILink): TPromise; } -export abstract class ExtHostQuickOpenShape { - $onItemSelected(handle: number): void { throw ni(); } - $validateInput(input: string): TPromise { throw ni(); } +export interface ExtHostQuickOpenShape { + $onItemSelected(handle: number): void; + $validateInput(input: string): TPromise; } -export abstract class ExtHostTerminalServiceShape { - $acceptTerminalClosed(id: number): void { throw ni(); } - $acceptTerminalProcessId(id: number, processId: number): void { throw ni(); } +export interface ExtHostTerminalServiceShape { + $acceptTerminalClosed(id: number): void; + $acceptTerminalProcessId(id: number, processId: number): void; } -export abstract class ExtHostSCMShape { - $provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise { throw ni(); } - $onActiveSourceControlChange(sourceControlHandle: number): TPromise { throw ni(); } - $onInputBoxValueChange(value: string): TPromise { throw ni(); } - $onInputBoxAcceptChanges(): TPromise { throw ni(); } +export interface ExtHostSCMShape { + $provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise; + $onActiveSourceControlChange(sourceControlHandle: number): TPromise; + $onInputBoxValueChange(value: string): TPromise; + $onInputBoxAcceptChanges(): TPromise; } -export abstract class ExtHostTaskShape { - $provideTasks(handle: number): TPromise { throw ni(); } +export interface ExtHostTaskShape { + $provideTasks(handle: number): TPromise; } -export abstract class ExtHostDebugServiceShape { - $acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void { throw ni(); } - $acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void { throw ni(); } - $acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void { throw ni(); } - $acceptDebugSessionCustomEvent(id: DebugSessionUUID, type: string, name: string, event: any): void { throw ni(); } +export interface ExtHostDebugServiceShape { + $acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void; + $acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void; + $acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void; + $acceptDebugSessionCustomEvent(id: DebugSessionUUID, type: string, name: string, event: any): void; } -export abstract class ExtHostCredentialsShape { +export interface ExtHostCredentialsShape { } // --- proxy identifiers export const MainContext = { - MainThreadCommands: createMainId('MainThreadCommands', MainThreadCommandsShape), - MainThreadConfiguration: createMainId('MainThreadConfiguration', MainThreadConfigurationShape), - MainThreadDebugService: createMainId('MainThreadDebugService', MainThreadDebugServiceShape), - MainThreadDiagnostics: createMainId('MainThreadDiagnostics', MainThreadDiagnosticsShape), - MainThreadDocuments: createMainId('MainThreadDocuments', MainThreadDocumentsShape), - MainThreadDocumentContentProviders: createMainId('MainThreadDocumentContentProviders', MainThreadDocumentContentProvidersShape), - MainThreadEditors: createMainId('MainThreadEditors', MainThreadEditorsShape), - MainThreadErrors: createMainId('MainThreadErrors', MainThreadErrorsShape), - MainThreadTreeViews: createMainId('MainThreadTreeViews', MainThreadTreeViewsShape), - MainThreadLanguageFeatures: createMainId('MainThreadLanguageFeatures', MainThreadLanguageFeaturesShape), - MainThreadLanguages: createMainId('MainThreadLanguages', MainThreadLanguagesShape), - MainThreadMessageService: createMainId('MainThreadMessageService', MainThreadMessageServiceShape), - MainThreadOutputService: createMainId('MainThreadOutputService', MainThreadOutputServiceShape), - MainThreadProgress: createMainId('MainThreadProgress', MainThreadProgressShape), - MainThreadQuickOpen: createMainId('MainThreadQuickOpen', MainThreadQuickOpenShape), - MainThreadStatusBar: createMainId('MainThreadStatusBar', MainThreadStatusBarShape), - MainThreadStorage: createMainId('MainThreadStorage', MainThreadStorageShape), - MainThreadTelemetry: createMainId('MainThreadTelemetry', MainThreadTelemetryShape), - MainThreadTerminalService: createMainId('MainThreadTerminalService', MainThreadTerminalServiceShape), - MainThreadWorkspace: createMainId('MainThreadWorkspace', MainThreadWorkspaceShape), - MainProcessExtensionService: createMainId('MainProcessExtensionService', MainProcessExtensionServiceShape), - MainThreadSCM: createMainId('MainThreadSCM', MainThreadSCMShape), - MainThreadTask: createMainId('MainThreadTask', MainThreadTaskShape), - MainThreadCredentials: createMainId('MainThreadCredentials', MainThreadCredentialsShape), + MainThreadCommands: createMainId('MainThreadCommands'), + MainThreadConfiguration: createMainId('MainThreadConfiguration'), + MainThreadDebugService: createMainId('MainThreadDebugService'), + MainThreadDiagnostics: createMainId('MainThreadDiagnostics'), + MainThreadDocuments: createMainId('MainThreadDocuments'), + MainThreadDocumentContentProviders: createMainId('MainThreadDocumentContentProviders'), + MainThreadEditors: createMainId('MainThreadEditors'), + MainThreadErrors: createMainId('MainThreadErrors'), + MainThreadTreeViews: createMainId('MainThreadTreeViews'), + MainThreadLanguageFeatures: createMainId('MainThreadLanguageFeatures'), + MainThreadLanguages: createMainId('MainThreadLanguages'), + MainThreadMessageService: createMainId('MainThreadMessageService'), + MainThreadOutputService: createMainId('MainThreadOutputService'), + MainThreadProgress: createMainId('MainThreadProgress'), + MainThreadQuickOpen: createMainId('MainThreadQuickOpen'), + MainThreadStatusBar: createMainId('MainThreadStatusBar'), + MainThreadStorage: createMainId('MainThreadStorage'), + MainThreadTelemetry: createMainId('MainThreadTelemetry'), + MainThreadTerminalService: createMainId('MainThreadTerminalService'), + MainThreadWorkspace: createMainId('MainThreadWorkspace'), + MainProcessExtensionService: createMainId('MainProcessExtensionService'), + MainThreadSCM: createMainId('MainThreadSCM'), + MainThreadTask: createMainId('MainThreadTask'), + MainThreadCredentials: createMainId('MainThreadCredentials'), }; export const ExtHostContext = { - ExtHostCommands: createExtId('ExtHostCommands', ExtHostCommandsShape), - ExtHostConfiguration: createExtId('ExtHostConfiguration', ExtHostConfigurationShape), - ExtHostDiagnostics: createExtId('ExtHostDiagnostics', ExtHostDiagnosticsShape), - ExtHostDebugService: createExtId('ExtHostDebugService', ExtHostDebugServiceShape), - ExtHostDocumentsAndEditors: createExtId('ExtHostDocumentsAndEditors', ExtHostDocumentsAndEditorsShape), - ExtHostDocuments: createExtId('ExtHostDocuments', ExtHostDocumentsShape), - ExtHostDocumentContentProviders: createExtId('ExtHostDocumentContentProviders', ExtHostDocumentContentProvidersShape), - ExtHostDocumentSaveParticipant: createExtId('ExtHostDocumentSaveParticipant', ExtHostDocumentSaveParticipantShape), - ExtHostEditors: createExtId('ExtHostEditors', ExtHostEditorsShape), - ExtHostTreeViews: createExtId('ExtHostTreeViews', ExtHostTreeViewsShape), - ExtHostFileSystemEventService: createExtId('ExtHostFileSystemEventService', ExtHostFileSystemEventServiceShape), - ExtHostHeapService: createExtId('ExtHostHeapMonitor', ExtHostHeapServiceShape), - ExtHostLanguageFeatures: createExtId('ExtHostLanguageFeatures', ExtHostLanguageFeaturesShape), - ExtHostQuickOpen: createExtId('ExtHostQuickOpen', ExtHostQuickOpenShape), - ExtHostExtensionService: createExtId('ExtHostExtensionService', ExtHostExtensionServiceShape), - ExtHostTerminalService: createExtId('ExtHostTerminalService', ExtHostTerminalServiceShape), - ExtHostSCM: createExtId('ExtHostSCM', ExtHostSCMShape), - ExtHostTask: createExtId('ExtHostTask', ExtHostTaskShape), - ExtHostWorkspace: createExtId('ExtHostWorkspace', ExtHostWorkspaceShape), - ExtHostCredentials: createExtId('ExtHostCredentials', ExtHostCredentialsShape), + ExtHostCommands: createExtId('ExtHostCommands'), + ExtHostConfiguration: createExtId('ExtHostConfiguration'), + ExtHostDiagnostics: createExtId('ExtHostDiagnostics'), + ExtHostDebugService: createExtId('ExtHostDebugService'), + ExtHostDocumentsAndEditors: createExtId('ExtHostDocumentsAndEditors'), + ExtHostDocuments: createExtId('ExtHostDocuments'), + ExtHostDocumentContentProviders: createExtId('ExtHostDocumentContentProviders'), + ExtHostDocumentSaveParticipant: createExtId('ExtHostDocumentSaveParticipant'), + ExtHostEditors: createExtId('ExtHostEditors'), + ExtHostTreeViews: createExtId('ExtHostTreeViews'), + ExtHostFileSystemEventService: createExtId('ExtHostFileSystemEventService'), + ExtHostHeapService: createExtId('ExtHostHeapMonitor'), + ExtHostLanguageFeatures: createExtId('ExtHostLanguageFeatures'), + ExtHostQuickOpen: createExtId('ExtHostQuickOpen'), + ExtHostExtensionService: createExtId('ExtHostExtensionService'), + ExtHostTerminalService: createExtId('ExtHostTerminalService'), + ExtHostSCM: createExtId('ExtHostSCM'), + ExtHostTask: createExtId('ExtHostTask'), + ExtHostWorkspace: createExtId('ExtHostWorkspace'), + ExtHostCredentials: createExtId('ExtHostCredentials'), }; diff --git a/src/vs/workbench/api/node/extHostCommands.ts b/src/vs/workbench/api/node/extHostCommands.ts index fed0dadf9cb..a67328f526e 100644 --- a/src/vs/workbench/api/node/extHostCommands.ts +++ b/src/vs/workbench/api/node/extHostCommands.ts @@ -26,7 +26,7 @@ export interface ArgumentProcessor { processArgument(arg: any): any; } -export class ExtHostCommands extends ExtHostCommandsShape { +export class ExtHostCommands implements ExtHostCommandsShape { private _commands = new Map(); private _proxy: MainThreadCommandsShape; @@ -37,7 +37,6 @@ export class ExtHostCommands extends ExtHostCommandsShape { mainContext: IMainContext, heapService: ExtHostHeapService ) { - super(); this._proxy = mainContext.get(MainContext.MainThreadCommands); this._converter = new CommandsConverter(this, heapService); } diff --git a/src/vs/workbench/api/node/extHostConfiguration.ts b/src/vs/workbench/api/node/extHostConfiguration.ts index 9cb6406ce2d..f12546ed3da 100644 --- a/src/vs/workbench/api/node/extHostConfiguration.ts +++ b/src/vs/workbench/api/node/extHostConfiguration.ts @@ -33,7 +33,7 @@ type ConfigurationInspect = { workspaceFolderValue?: T; }; -export class ExtHostConfiguration extends ExtHostConfigurationShape { +export class ExtHostConfiguration implements ExtHostConfigurationShape { private readonly _onDidChangeConfiguration = new Emitter(); private readonly _proxy: MainThreadConfigurationShape; @@ -41,7 +41,6 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape { private _configuration: Configuration; constructor(proxy: MainThreadConfigurationShape, extHostWorkspace: ExtHostWorkspace, data: IConfigurationData) { - super(); this._proxy = proxy; this._extHostWorkspace = extHostWorkspace; this._configuration = Configuration.parse(data, extHostWorkspace.workspace); diff --git a/src/vs/workbench/api/node/extHostCredentials.ts b/src/vs/workbench/api/node/extHostCredentials.ts index 0ef4e2dfc0e..de7a8ef0181 100644 --- a/src/vs/workbench/api/node/extHostCredentials.ts +++ b/src/vs/workbench/api/node/extHostCredentials.ts @@ -7,12 +7,11 @@ import { MainContext, MainThreadCredentialsShape, ExtHostCredentialsShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol'; -export class ExtHostCredentials extends ExtHostCredentialsShape { +export class ExtHostCredentials implements ExtHostCredentialsShape { private _proxy: MainThreadCredentialsShape; constructor(mainContext: IMainContext) { - super(); this._proxy = mainContext.get(MainContext.MainThreadCredentials); }; diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index c131769ff86..10fab6b11d4 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -13,7 +13,7 @@ import * as vscode from 'vscode'; import URI from 'vs/base/common/uri'; -export class ExtHostDebugService extends ExtHostDebugServiceShape { +export class ExtHostDebugService implements ExtHostDebugServiceShape { private _debugServiceProxy: MainThreadDebugServiceShape; private _debugSessions: Map = new Map(); @@ -35,8 +35,6 @@ export class ExtHostDebugService extends ExtHostDebugServiceShape { constructor(mainContext: IMainContext) { - super(); - this._onDidStartDebugSession = new Emitter(); this._onDidTerminateDebugSession = new Emitter(); this._onDidChangeActiveDebugSession = new Emitter(); diff --git a/src/vs/workbench/api/node/extHostDiagnostics.ts b/src/vs/workbench/api/node/extHostDiagnostics.ts index 1a24e644fe5..1a200433765 100644 --- a/src/vs/workbench/api/node/extHostDiagnostics.ts +++ b/src/vs/workbench/api/node/extHostDiagnostics.ts @@ -216,7 +216,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection { } } -export class ExtHostDiagnostics extends ExtHostDiagnosticsShape { +export class ExtHostDiagnostics implements ExtHostDiagnosticsShape { private static _idPool: number = 0; @@ -224,7 +224,6 @@ export class ExtHostDiagnostics extends ExtHostDiagnosticsShape { private _collections: DiagnosticCollection[]; constructor(mainContext: IMainContext) { - super(); this._proxy = mainContext.get(MainContext.MainThreadDiagnostics); this._collections = []; } diff --git a/src/vs/workbench/api/node/extHostDocumentContentProviders.ts b/src/vs/workbench/api/node/extHostDocumentContentProviders.ts index 9ea785f73c7..b418248c49b 100644 --- a/src/vs/workbench/api/node/extHostDocumentContentProviders.ts +++ b/src/vs/workbench/api/node/extHostDocumentContentProviders.ts @@ -17,7 +17,7 @@ import { TextSource } from 'vs/editor/common/model/textSource'; import { MainContext, ExtHostDocumentContentProvidersShape, MainThreadDocumentContentProvidersShape } from './extHost.protocol'; import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors'; -export class ExtHostDocumentContentProvider extends ExtHostDocumentContentProvidersShape { +export class ExtHostDocumentContentProvider implements ExtHostDocumentContentProvidersShape { private static _handlePool = 0; @@ -26,7 +26,6 @@ export class ExtHostDocumentContentProvider extends ExtHostDocumentContentProvid private readonly _documentsAndEditors: ExtHostDocumentsAndEditors; constructor(threadService: IThreadService, documentsAndEditors: ExtHostDocumentsAndEditors) { - super(); this._proxy = threadService.get(MainContext.MainThreadDocumentContentProviders); this._documentsAndEditors = documentsAndEditors; } diff --git a/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts b/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts index 94a82a1a272..90e5e6e0d81 100644 --- a/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts +++ b/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts @@ -18,7 +18,7 @@ import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments'; import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles'; import * as vscode from 'vscode'; -export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipantShape { +export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSaveParticipantShape { private _documents: ExtHostDocuments; private _workspace: MainThreadWorkspaceShape; @@ -27,7 +27,6 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa private _thresholds: { timeout: number; errors: number; }; constructor(documents: ExtHostDocuments, workspace: MainThreadWorkspaceShape, thresholds: { timeout: number; errors: number; } = { timeout: 1500, errors: 3 }) { - super(); this._documents = documents; this._workspace = workspace; this._thresholds = thresholds; diff --git a/src/vs/workbench/api/node/extHostDocuments.ts b/src/vs/workbench/api/node/extHostDocuments.ts index 83e16e3ae14..131b85bd766 100644 --- a/src/vs/workbench/api/node/extHostDocuments.ts +++ b/src/vs/workbench/api/node/extHostDocuments.ts @@ -15,7 +15,7 @@ import { ExtHostDocumentData, setWordDefinitionFor } from './extHostDocumentData import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors'; import { IModelChangedEvent } from 'vs/editor/common/model/mirrorModel'; -export class ExtHostDocuments extends ExtHostDocumentsShape { +export class ExtHostDocuments implements ExtHostDocumentsShape { private _onDidAddDocument = new Emitter(); private _onDidRemoveDocument = new Emitter(); @@ -33,7 +33,6 @@ export class ExtHostDocuments extends ExtHostDocumentsShape { private _documentLoader = new Map>(); constructor(mainContext: IMainContext, documentsAndEditors: ExtHostDocumentsAndEditors) { - super(); this._proxy = mainContext.get(MainContext.MainThreadDocuments); this._documentsAndEditors = documentsAndEditors; diff --git a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts index 516478d15ea..da9cc09702c 100644 --- a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts +++ b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts @@ -12,7 +12,7 @@ import { ExtHostTextEditor } from './extHostTextEditor'; import * as assert from 'assert'; import * as typeConverters from './extHostTypeConverters'; -export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape { +export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsShape { private _activeEditorId: string; private readonly _editors = new Map(); @@ -31,7 +31,6 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape constructor( private readonly _mainContext: IMainContext ) { - super(); } $acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void { diff --git a/src/vs/workbench/api/node/extHostFileSystemEventService.ts b/src/vs/workbench/api/node/extHostFileSystemEventService.ts index 0e6ddf0a9ac..822298414c3 100644 --- a/src/vs/workbench/api/node/extHostFileSystemEventService.ts +++ b/src/vs/workbench/api/node/extHostFileSystemEventService.ts @@ -87,12 +87,11 @@ class FileSystemWatcher implements _FileSystemWatcher { } } -export class ExtHostFileSystemEventService extends ExtHostFileSystemEventServiceShape { +export class ExtHostFileSystemEventService implements ExtHostFileSystemEventServiceShape { private _emitter = new Emitter(); constructor() { - super(); } public createFileSystemWatcher(globPattern: string, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): _FileSystemWatcher { diff --git a/src/vs/workbench/api/node/extHostHeapService.ts b/src/vs/workbench/api/node/extHostHeapService.ts index 62c38b8528a..c0f1f3e2a95 100644 --- a/src/vs/workbench/api/node/extHostHeapService.ts +++ b/src/vs/workbench/api/node/extHostHeapService.ts @@ -6,7 +6,7 @@ import { ExtHostHeapServiceShape } from './extHost.protocol'; -export class ExtHostHeapService extends ExtHostHeapServiceShape { +export class ExtHostHeapService implements ExtHostHeapServiceShape { private static _idPool = 0; diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index 9cac000209a..fa223101e15 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -723,7 +723,7 @@ type Adapter = OutlineAdapter | CodeLensAdapter | DefinitionAdapter | HoverAdapt | RangeFormattingAdapter | OnTypeFormattingAdapter | NavigateTypeAdapter | RenameAdapter | SuggestAdapter | SignatureHelpAdapter | LinkProviderAdapter | ImplementationAdapter | TypeDefinitionAdapter | ColorProviderAdapter; -export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape { +export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape { private static _handlePool: number = 0; @@ -742,7 +742,6 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape { heapMonitor: ExtHostHeapService, diagnostics: ExtHostDiagnostics ) { - super(); this._proxy = mainContext.get(MainContext.MainThreadLanguageFeatures); this._documents = documents; this._commands = commands; diff --git a/src/vs/workbench/api/node/extHostQuickOpen.ts b/src/vs/workbench/api/node/extHostQuickOpen.ts index a96e27f9f61..edaaf12385d 100644 --- a/src/vs/workbench/api/node/extHostQuickOpen.ts +++ b/src/vs/workbench/api/node/extHostQuickOpen.ts @@ -12,14 +12,13 @@ import { MainContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPi export type Item = string | QuickPickItem; -export class ExtHostQuickOpen extends ExtHostQuickOpenShape { +export class ExtHostQuickOpen implements ExtHostQuickOpenShape { private _proxy: MainThreadQuickOpenShape; private _onDidSelectItem: (handle: number) => void; private _validateInput: (input: string) => string; constructor(mainContext: IMainContext) { - super(); this._proxy = mainContext.get(MainContext.MainThreadQuickOpen); } diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index cca7188f101..94e98f427f9 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -395,14 +395,13 @@ interface HandlerData { extension: IExtensionDescription; } -export class ExtHostTask extends ExtHostTaskShape { +export class ExtHostTask implements ExtHostTaskShape { private _proxy: MainThreadTaskShape; private _handleCounter: number; private _handlers: Map; constructor(mainContext: IMainContext) { - super(); this._proxy = mainContext.get(MainContext.MainThreadTask); this._handleCounter = 0; this._handlers = new Map(); diff --git a/src/vs/workbench/api/node/extHostTextEditors.ts b/src/vs/workbench/api/node/extHostTextEditors.ts index 95306ae27e3..e820774046d 100644 --- a/src/vs/workbench/api/node/extHostTextEditors.ts +++ b/src/vs/workbench/api/node/extHostTextEditors.ts @@ -16,7 +16,7 @@ import { Position as EditorPosition } from 'vs/platform/editor/common/editor'; import { MainContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextDocumentShowOptions, ITextEditorPositionData, IResolvedTextEditorConfiguration, ISelectionChangeEvent, IMainContext } from './extHost.protocol'; import * as vscode from 'vscode'; -export class ExtHostEditors extends ExtHostEditorsShape { +export class ExtHostEditors implements ExtHostEditorsShape { private readonly _onDidChangeTextEditorSelection = new Emitter(); private readonly _onDidChangeTextEditorOptions = new Emitter(); @@ -38,7 +38,6 @@ export class ExtHostEditors extends ExtHostEditorsShape { mainContext: IMainContext, extHostDocumentsAndEditors: ExtHostDocumentsAndEditors, ) { - super(); this._proxy = mainContext.get(MainContext.MainThreadEditors); this._extHostDocumentsAndEditors = extHostDocumentsAndEditors; diff --git a/src/vs/workbench/api/node/extHostTreeViews.ts b/src/vs/workbench/api/node/extHostTreeViews.ts index cd48700d84f..e39851fe243 100644 --- a/src/vs/workbench/api/node/extHostTreeViews.ts +++ b/src/vs/workbench/api/node/extHostTreeViews.ts @@ -19,7 +19,7 @@ import { asWinJsPromise } from 'vs/base/common/async'; type TreeItemHandle = number; -export class ExtHostTreeViews extends ExtHostTreeViewsShape { +export class ExtHostTreeViews implements ExtHostTreeViewsShape { private treeViews: Map> = new Map>(); @@ -27,7 +27,6 @@ export class ExtHostTreeViews extends ExtHostTreeViewsShape { private _proxy: MainThreadTreeViewsShape, private commands: ExtHostCommands ) { - super(); commands.registerArgumentProcessor({ processArgument: arg => { if (arg && arg.$treeViewId && arg.$treeItemHandle) { diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index 2d1c370653f..2c61808088e 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -65,7 +65,7 @@ class Workspace2 extends Workspace { } } -export class ExtHostWorkspace extends ExtHostWorkspaceShape { +export class ExtHostWorkspace implements ExtHostWorkspaceShape { private static _requestIdPool = 0; @@ -76,7 +76,6 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape { readonly onDidChangeWorkspace: Event = this._onDidChangeWorkspace.event; constructor(mainContext: IMainContext, data: IWorkspaceData) { - super(); this._proxy = mainContext.get(MainContext.MainThreadWorkspace); this._workspace = Workspace2.fromData(data); } diff --git a/src/vs/workbench/services/thread/common/threadService.ts b/src/vs/workbench/services/thread/common/threadService.ts index 071359fd603..8906d6b8821 100644 --- a/src/vs/workbench/services/thread/common/threadService.ts +++ b/src/vs/workbench/services/thread/common/threadService.ts @@ -27,25 +27,17 @@ export class ProxyIdentifier { isMain: boolean; id: string; - methodNames: string[]; - constructor(isMain: boolean, id: string, ctor: Function) { + constructor(isMain: boolean, id: string) { this.isMain = isMain; this.id = id; - - this.methodNames = []; - for (let prop in ctor.prototype) { - if (typeof ctor.prototype[prop] === 'function') { - this.methodNames.push(prop); - } - } } } -export function createMainContextProxyIdentifier(identifier: string, ctor: Function): ProxyIdentifier { - return new ProxyIdentifier(true, 'm' + identifier, ctor); +export function createMainContextProxyIdentifier(identifier: string): ProxyIdentifier { + return new ProxyIdentifier(true, 'm' + identifier); } -export function createExtHostContextProxyIdentifier(identifier: string, ctor: Function): ProxyIdentifier { - return new ProxyIdentifier(false, 'e' + identifier, ctor); +export function createExtHostContextProxyIdentifier(identifier: string): ProxyIdentifier { + return new ProxyIdentifier(false, 'e' + identifier); } diff --git a/src/vs/workbench/services/thread/node/abstractThreadService.ts b/src/vs/workbench/services/thread/node/abstractThreadService.ts index a76b2f82fac..04fc8ae314e 100644 --- a/src/vs/workbench/services/thread/node/abstractThreadService.ts +++ b/src/vs/workbench/services/thread/node/abstractThreadService.ts @@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { IDispatcher, RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol'; import { ProxyIdentifier } from 'vs/workbench/services/thread/common/threadService'; -// declare var Proxy:any; // TODO@TypeScript +declare var Proxy: any; // TODO@TypeScript export abstract class AbstractThreadService implements IDispatcher { @@ -39,34 +39,20 @@ export abstract class AbstractThreadService implements IDispatcher { get(identifier: ProxyIdentifier): T { if (!this._proxies[identifier.id]) { - this._proxies[identifier.id] = this._createProxy(identifier.id, identifier.methodNames); + this._proxies[identifier.id] = this._createProxy(identifier.id); } return this._proxies[identifier.id]; } - private _createProxy(proxyId: string, methodNames: string[]): T { - // Check below how to switch to native proxies - let result: any = {}; - for (let i = 0; i < methodNames.length; i++) { - let methodName = methodNames[i]; - result[methodName] = this._createMethodProxy(proxyId, methodName); - } - return result; - - // let handler = { - // get: (target, name) => { - // return (...myArgs: any[]) => { - // return this._callOnRemote(id, name, myArgs); - // }; - // } - // }; - // return new Proxy({}, handler); - } - - private _createMethodProxy(proxyId: string, methodName: string): (...myArgs: any[]) => TPromise { - return (...myArgs: any[]) => { - return this._callOnRemote(proxyId, methodName, myArgs); + private _createProxy(proxyId: string): T { + let handler = { + get: (target, name) => { + return (...myArgs: any[]) => { + return this._callOnRemote(proxyId, name, myArgs); + }; + } }; + return new Proxy({}, handler); } set(identifier: ProxyIdentifier, value: T): void { diff --git a/src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts index 9e4fb57d019..13262ae8659 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts @@ -11,6 +11,7 @@ import { MainThreadCommandsShape } from 'vs/workbench/api/node/extHost.protocol' import { TPromise } from 'vs/base/common/winjs.base'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { OneGetThreadService } from './testThreadService'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostCommands', function () { @@ -18,7 +19,7 @@ suite('ExtHostCommands', function () { let lastUnregister: string; - const shape = new class extends MainThreadCommandsShape { + const shape = new class extends mock() { $registerCommand(id: string): TPromise { return undefined; } @@ -39,7 +40,7 @@ suite('ExtHostCommands', function () { let unregisterCounter = 0; - const shape = new class extends MainThreadCommandsShape { + const shape = new class extends mock() { $registerCommand(id: string): TPromise { return undefined; } diff --git a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts index 68578048215..7862f13e766 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts @@ -14,10 +14,11 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { ConfigurationTarget, ConfigurationEditingErrorCode, ConfigurationEditingError } from 'vs/workbench/services/configuration/common/configurationEditing'; import { ConfigurationModel } from 'vs/platform/configuration/common/configuration'; import { TestThreadService } from './testThreadService'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostConfiguration', function () { - class RecordingShape extends MainThreadConfigurationShape { + class RecordingShape extends mock() { lastArgs: [ConfigurationTarget, string, any]; $updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise { this.lastArgs = [target, key, value]; @@ -27,7 +28,7 @@ suite('ExtHostConfiguration', function () { function createExtHostConfiguration(contents: any = Object.create(null), shape?: MainThreadConfigurationShape) { if (!shape) { - shape = new class extends MainThreadConfigurationShape { }; + shape = new class extends mock() { }; } return new ExtHostConfiguration(shape, new ExtHostWorkspace(new TestThreadService(), null), { defaults: new ConfigurationModel(contents), @@ -86,7 +87,7 @@ suite('ExtHostConfiguration', function () { test('inspect in no workspace context', function () { const testObject = new ExtHostConfiguration( - new class extends MainThreadConfigurationShape { }, + new class extends mock() { }, new ExtHostWorkspace(new TestThreadService(), null), { defaults: new ConfigurationModel({ @@ -127,7 +128,7 @@ suite('ExtHostConfiguration', function () { }, ['editor.wordWrap']); folders[workspaceUri.toString()] = workspace; const testObject = new ExtHostConfiguration( - new class extends MainThreadConfigurationShape { }, + new class extends mock() { }, new ExtHostWorkspace(new TestThreadService(), { 'id': 'foo', 'roots': [URI.file('foo')], @@ -199,7 +200,7 @@ suite('ExtHostConfiguration', function () { folders[thirdRoot.toString()] = new ConfigurationModel({}, []); const testObject = new ExtHostConfiguration( - new class extends MainThreadConfigurationShape { }, + new class extends mock() { }, new ExtHostWorkspace(new TestThreadService(), { 'id': 'foo', 'roots': [firstRoot, secondRoot], @@ -374,7 +375,7 @@ suite('ExtHostConfiguration', function () { test('update/error-state not OK', function () { - const shape = new class extends MainThreadConfigurationShape { + const shape = new class extends mock() { $updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise { return TPromise.wrapError(new ConfigurationEditingError('Unknown Key', ConfigurationEditingErrorCode.ERROR_UNKNOWN_KEY)); // something !== OK } diff --git a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts index 391a9665d41..2c7ffcc0988 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts @@ -13,10 +13,11 @@ import { Diagnostic, DiagnosticSeverity, Range } from 'vs/workbench/api/node/ext import { MainThreadDiagnosticsShape } from 'vs/workbench/api/node/extHost.protocol'; import { TPromise } from 'vs/base/common/winjs.base'; import { IMarkerData } from 'vs/platform/markers/common/markers'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostDiagnostics', () => { - class DiagnosticsShape extends MainThreadDiagnosticsShape { + class DiagnosticsShape extends mock() { $changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise { return TPromise.as(null); } diff --git a/src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts index a4c48b2f95a..10ce36a833b 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts @@ -13,6 +13,7 @@ import { Range } from 'vs/editor/common/core/range'; import { MainThreadDocumentsShape } from 'vs/workbench/api/node/extHost.protocol'; import { TPromise } from 'vs/base/common/winjs.base'; import { IModelChangedEvent } from 'vs/editor/common/model/mirrorModel'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostDocumentData', () => { @@ -51,7 +52,7 @@ suite('ExtHostDocumentData', () => { test('save, when disposed', function () { let saved: URI; - let data = new ExtHostDocumentData(new class extends MainThreadDocumentsShape { + let data = new ExtHostDocumentData(new class extends mock() { $trySaveDocument(uri) { assert.ok(!saved); saved = uri; diff --git a/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts index 9445d6bcaf2..77da53ad2a6 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts @@ -16,11 +16,12 @@ import { OneGetThreadService } from './testThreadService'; import { IResourceEdit } from 'vs/editor/common/services/bulkEdit'; import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles'; import * as vscode from 'vscode'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostDocumentSaveParticipant', () => { let resource = URI.parse('foo:bar'); - let workspace = new class extends MainThreadWorkspaceShape { }; + let workspace = new class extends mock() { }; let documents: ExtHostDocuments; setup(() => { @@ -253,7 +254,7 @@ suite('ExtHostDocumentSaveParticipant', () => { test('event delivery, pushEdits sync', () => { let edits: IResourceEdit[]; - const participant = new ExtHostDocumentSaveParticipant(documents, new class extends MainThreadWorkspaceShape { + const participant = new ExtHostDocumentSaveParticipant(documents, new class extends mock() { $applyWorkspaceEdit(_edits) { edits = _edits; return TPromise.as(true); @@ -275,7 +276,7 @@ suite('ExtHostDocumentSaveParticipant', () => { test('event delivery, concurrent change', () => { let edits: IResourceEdit[]; - const participant = new ExtHostDocumentSaveParticipant(documents, new class extends MainThreadWorkspaceShape { + const participant = new ExtHostDocumentSaveParticipant(documents, new class extends mock() { $applyWorkspaceEdit(_edits) { edits = _edits; return TPromise.as(true); @@ -309,7 +310,7 @@ suite('ExtHostDocumentSaveParticipant', () => { test('event delivery, two listeners -> two document states', () => { - const participant = new ExtHostDocumentSaveParticipant(documents, new class extends MainThreadWorkspaceShape { + const participant = new ExtHostDocumentSaveParticipant(documents, new class extends mock() { $applyWorkspaceEdit(_edits: IResourceEdit[]) { for (const { resource, newText, range } of _edits) { diff --git a/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts index 7cac271a037..72794bd59c8 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts @@ -17,11 +17,12 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/ import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; import { MainThreadCommands } from 'vs/workbench/api/electron-browser/mainThreadCommands'; import { IInstantiationService } from "vs/platform/instantiation/common/instantiation"; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('ExtHostConfiguration', function () { - class RecordingShape extends MainThreadTreeViewsShape { + class RecordingShape extends mock() { onRefresh = new Emitter(); diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts index 3e809f5a8e8..86713fd8410 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts @@ -15,6 +15,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { ExtHostDocumentsAndEditorsShape, IDocumentsAndEditorsDelta } from 'vs/workbench/api/node/extHost.protocol'; import { mockCodeEditor } from 'vs/editor/test/common/mocks/mockCodeEditor'; +import { mock } from "vs/workbench/test/electron-browser/api/mock"; suite('MainThreadDocumentsAndEditors', () => { @@ -40,7 +41,7 @@ suite('MainThreadDocumentsAndEditors', () => { documentAndEditor = new MainThreadDocumentsAndEditors( modelService, textFileService, workbenchEditorService, - OneGetThreadService(new class extends ExtHostDocumentsAndEditorsShape { + OneGetThreadService(new class extends mock() { $acceptDocumentsAndEditorsDelta(delta) { deltas.push(delta); } }), codeEditorService ); diff --git a/src/vs/workbench/test/electron-browser/api/mock.ts b/src/vs/workbench/test/electron-browser/api/mock.ts new file mode 100644 index 00000000000..622f52cade3 --- /dev/null +++ b/src/vs/workbench/test/electron-browser/api/mock.ts @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +export interface Ctor { + new(): T; +} + +export function mock(): Ctor { + return function () { }; +} diff --git a/src/vs/workbench/test/electron-browser/api/testThreadService.ts b/src/vs/workbench/test/electron-browser/api/testThreadService.ts index 4ab57cdf243..4500472b55b 100644 --- a/src/vs/workbench/test/electron-browser/api/testThreadService.ts +++ b/src/vs/workbench/test/electron-browser/api/testThreadService.ts @@ -20,6 +20,8 @@ export function OneGetThreadService(thing: any): IThreadService { }; } +declare var Proxy; // TODO@TypeScript + export abstract class AbstractTestThreadService { private _isMain: boolean; @@ -46,34 +48,20 @@ export abstract class AbstractTestThreadService { get(identifier: ProxyIdentifier): T { if (!this._proxies[identifier.id]) { - this._proxies[identifier.id] = this._createProxy(identifier.id, identifier.methodNames); + this._proxies[identifier.id] = this._createProxy(identifier.id); } return this._proxies[identifier.id]; } - private _createProxy(id: string, methodNames: string[]): T { - // Check below how to switch to native proxies - let result: any = {}; - for (let i = 0; i < methodNames.length; i++) { - let methodName = methodNames[i]; - result[methodName] = this.createMethodProxy(id, methodName); - } - return result; - - // let handler = { - // get: (target, name) => { - // return (...myArgs: any[]) => { - // return this._callOnRemote(id, name, myArgs); - // }; - // } - // }; - // return new Proxy({}, handler); - } - - private createMethodProxy(id: string, methodName: string): (...myArgs: any[]) => TPromise { - return (...myArgs: any[]) => { - return this._callOnRemote(id, methodName, myArgs); + private _createProxy(id: string): T { + let handler = { + get: (target, name) => { + return (...myArgs: any[]) => { + return this._callOnRemote(id, name, myArgs); + }; + } }; + return new Proxy({}, handler); } set(identifier: ProxyIdentifier, value: T): void {