debt - remove TPromise from ExtHostDebug

This commit is contained in:
Johannes Rieken 2018-09-06 16:18:52 +02:00
parent 5c5877d686
commit 2b960fb0ff
3 changed files with 22 additions and 22 deletions

View file

@ -68,11 +68,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
}
substituteVariables(folder: IWorkspaceFolder, config: IConfig): TPromise<IConfig> {
return this._proxy.$substituteVariables(folder ? folder.uri : undefined, config);
return TPromise.wrap(this._proxy.$substituteVariables(folder ? folder.uri : undefined, config));
}
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): TPromise<void> {
return this._proxy.$runInTerminal(args, config);
return TPromise.wrap(this._proxy.$runInTerminal(args, config));
}
public dispose(): void {
@ -184,17 +184,17 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
};
if (hasProvide) {
provider.provideDebugConfigurations = folder => {
return this._proxy.$provideDebugConfigurations(handle, folder);
return TPromise.wrap(this._proxy.$provideDebugConfigurations(handle, folder));
};
}
if (hasResolve) {
provider.resolveDebugConfiguration = (folder, debugConfiguration) => {
return this._proxy.$resolveDebugConfiguration(handle, folder, debugConfiguration);
return TPromise.wrap(this._proxy.$resolveDebugConfiguration(handle, folder, debugConfiguration));
};
}
if (hasDebugAdapterExecutable) {
provider.debugAdapterExecutable = (folder) => {
return this._proxy.$debugAdapterExecutable(handle, folder);
return TPromise.wrap(this._proxy.$debugAdapterExecutable(handle, folder));
};
}
this.debugService.getConfigurationManager().registerDebugConfigurationProvider(handle, provider);
@ -275,7 +275,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
}
public startSession(): TPromise<void> {
return this._proxy.$startDASession(this._handle, this._debugType, this._adapterExecutable, this._debugPort);
return TPromise.wrap(this._proxy.$startDASession(this._handle, this._debugType, this._adapterExecutable, this._debugPort));
}
public sendMessage(message: DebugProtocol.ProtocolMessage): void {
@ -292,6 +292,6 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
}
public stopSession(): TPromise<void> {
return this._proxy.$stopDASession(this._handle);
return TPromise.wrap(this._proxy.$stopDASession(this._handle));
}
}

View file

@ -8,7 +8,6 @@ import { SerializedError } from 'vs/base/common/errors';
import { IDisposable } from 'vs/base/common/lifecycle';
import Severity from 'vs/base/common/severity';
import { URI, UriComponents } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
import { IPosition } from 'vs/editor/common/core/position';
import { IRange } from 'vs/editor/common/core/range';
@ -944,14 +943,14 @@ export interface ISourceMultiBreakpointDto {
}
export interface ExtHostDebugServiceShape {
$substituteVariables(folder: UriComponents | undefined, config: IConfig): TPromise<IConfig>;
$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): TPromise<void>;
$startDASession(handle: number, debugType: string, adapterExecutableInfo: IAdapterExecutable | null, debugPort: number): TPromise<void>;
$stopDASession(handle: number): TPromise<void>;
$substituteVariables(folder: UriComponents | undefined, config: IConfig): Thenable<IConfig>;
$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Thenable<void>;
$startDASession(handle: number, debugType: string, adapterExecutableInfo: IAdapterExecutable | null, debugPort: number): Thenable<void>;
$stopDASession(handle: number): Thenable<void>;
$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): TPromise<IConfig>;
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined): TPromise<IConfig[]>;
$debugAdapterExecutable(handle: number, folder: UriComponents | undefined): TPromise<IAdapterExecutable>;
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): Thenable<IConfig>;
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined): Thenable<IConfig[]>;
$debugAdapterExecutable(handle: number, folder: UriComponents | undefined): Thenable<IAdapterExecutable>;
$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;

View file

@ -9,7 +9,7 @@ import { Schemas } from 'vs/base/common/network';
import { URI, UriComponents } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { Event, Emitter } from 'vs/base/common/event';
import { asWinJsPromise } from 'vs/base/common/async';
import { asThenable } from 'vs/base/common/async';
import * as nls from 'vs/nls';
import {
MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID,
@ -31,6 +31,7 @@ import { convertToVSCPaths, convertToDAPaths } from 'vs/workbench/parts/debug/co
import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { CancellationToken } from 'vs/base/common/cancellation';
export class ExtHostDebugService implements ExtHostDebugServiceShape {
@ -451,7 +452,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
});
}
public $provideDebugConfigurations(handle: number, folderUri: UriComponents | undefined): TPromise<vscode.DebugConfiguration[]> {
public $provideDebugConfigurations(handle: number, folderUri: UriComponents | undefined): Thenable<vscode.DebugConfiguration[]> {
let handler = this._handlers.get(handle);
if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('no handler found'));
@ -459,10 +460,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.provideDebugConfigurations) {
return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('handler has no method provideDebugConfigurations'));
}
return asWinJsPromise(token => handler.provideDebugConfigurations(this.getFolder(folderUri), token));
return asThenable(() => handler.provideDebugConfigurations(this.getFolder(folderUri), CancellationToken.None));
}
public $resolveDebugConfiguration(handle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): TPromise<vscode.DebugConfiguration> {
public $resolveDebugConfiguration(handle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): Thenable<vscode.DebugConfiguration> {
let handler = this._handlers.get(handle);
if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration>(new Error('no handler found'));
@ -470,10 +471,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.resolveDebugConfiguration) {
return TPromise.wrapError<vscode.DebugConfiguration>(new Error('handler has no method resolveDebugConfiguration'));
}
return asWinJsPromise(token => handler.resolveDebugConfiguration(this.getFolder(folderUri), debugConfiguration, token));
return asThenable(() => handler.resolveDebugConfiguration(this.getFolder(folderUri), debugConfiguration, CancellationToken.None));
}
public $debugAdapterExecutable(handle: number, folderUri: UriComponents | undefined): TPromise<vscode.DebugAdapterExecutable> {
public $debugAdapterExecutable(handle: number, folderUri: UriComponents | undefined): Thenable<vscode.DebugAdapterExecutable> {
let handler = this._handlers.get(handle);
if (!handler) {
return TPromise.wrapError<vscode.DebugAdapterExecutable>(new Error('no handler found'));
@ -481,7 +482,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.debugAdapterExecutable) {
return TPromise.wrapError<vscode.DebugAdapterExecutable>(new Error('handler has no method debugAdapterExecutable'));
}
return asWinJsPromise(token => handler.debugAdapterExecutable(this.getFolder(folderUri), token));
return asThenable(() => handler.debugAdapterExecutable(this.getFolder(folderUri), CancellationToken.None));
}
public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration): Thenable<boolean> {