提交 2b960fb0 编写于 作者: J Johannes Rieken

debt - remove TPromise from ExtHostDebug

上级 5c5877d6
...@@ -68,11 +68,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb ...@@ -68,11 +68,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
} }
substituteVariables(folder: IWorkspaceFolder, config: IConfig): TPromise<IConfig> { 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> { 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 { public dispose(): void {
...@@ -184,17 +184,17 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb ...@@ -184,17 +184,17 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
}; };
if (hasProvide) { if (hasProvide) {
provider.provideDebugConfigurations = folder => { provider.provideDebugConfigurations = folder => {
return this._proxy.$provideDebugConfigurations(handle, folder); return TPromise.wrap(this._proxy.$provideDebugConfigurations(handle, folder));
}; };
} }
if (hasResolve) { if (hasResolve) {
provider.resolveDebugConfiguration = (folder, debugConfiguration) => { provider.resolveDebugConfiguration = (folder, debugConfiguration) => {
return this._proxy.$resolveDebugConfiguration(handle, folder, debugConfiguration); return TPromise.wrap(this._proxy.$resolveDebugConfiguration(handle, folder, debugConfiguration));
}; };
} }
if (hasDebugAdapterExecutable) { if (hasDebugAdapterExecutable) {
provider.debugAdapterExecutable = (folder) => { provider.debugAdapterExecutable = (folder) => {
return this._proxy.$debugAdapterExecutable(handle, folder); return TPromise.wrap(this._proxy.$debugAdapterExecutable(handle, folder));
}; };
} }
this.debugService.getConfigurationManager().registerDebugConfigurationProvider(handle, provider); this.debugService.getConfigurationManager().registerDebugConfigurationProvider(handle, provider);
...@@ -275,7 +275,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter { ...@@ -275,7 +275,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
} }
public startSession(): TPromise<void> { 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 { public sendMessage(message: DebugProtocol.ProtocolMessage): void {
...@@ -292,6 +292,6 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter { ...@@ -292,6 +292,6 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
} }
public stopSession(): TPromise<void> { public stopSession(): TPromise<void> {
return this._proxy.$stopDASession(this._handle); return TPromise.wrap(this._proxy.$stopDASession(this._handle));
} }
} }
...@@ -8,7 +8,6 @@ import { SerializedError } from 'vs/base/common/errors'; ...@@ -8,7 +8,6 @@ import { SerializedError } from 'vs/base/common/errors';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { URI, UriComponents } from 'vs/base/common/uri'; 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 { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
import { IPosition } from 'vs/editor/common/core/position'; import { IPosition } from 'vs/editor/common/core/position';
import { IRange } from 'vs/editor/common/core/range'; import { IRange } from 'vs/editor/common/core/range';
...@@ -944,14 +943,14 @@ export interface ISourceMultiBreakpointDto { ...@@ -944,14 +943,14 @@ export interface ISourceMultiBreakpointDto {
} }
export interface ExtHostDebugServiceShape { export interface ExtHostDebugServiceShape {
$substituteVariables(folder: UriComponents | undefined, config: IConfig): TPromise<IConfig>; $substituteVariables(folder: UriComponents | undefined, config: IConfig): Thenable<IConfig>;
$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): TPromise<void>; $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Thenable<void>;
$startDASession(handle: number, debugType: string, adapterExecutableInfo: IAdapterExecutable | null, debugPort: number): TPromise<void>; $startDASession(handle: number, debugType: string, adapterExecutableInfo: IAdapterExecutable | null, debugPort: number): Thenable<void>;
$stopDASession(handle: number): TPromise<void>; $stopDASession(handle: number): Thenable<void>;
$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void; $sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): TPromise<IConfig>; $resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): Thenable<IConfig>;
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined): TPromise<IConfig[]>; $provideDebugConfigurations(handle: number, folder: UriComponents | undefined): Thenable<IConfig[]>;
$debugAdapterExecutable(handle: number, folder: UriComponents | undefined): TPromise<IAdapterExecutable>; $debugAdapterExecutable(handle: number, folder: UriComponents | undefined): Thenable<IAdapterExecutable>;
$acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void; $acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void;
$acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void; $acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void;
$acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void; $acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void;
......
...@@ -9,7 +9,7 @@ import { Schemas } from 'vs/base/common/network'; ...@@ -9,7 +9,7 @@ import { Schemas } from 'vs/base/common/network';
import { URI, UriComponents } from 'vs/base/common/uri'; import { URI, UriComponents } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { Event, Emitter } from 'vs/base/common/event'; 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 * as nls from 'vs/nls';
import { import {
MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID, MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID,
...@@ -31,6 +31,7 @@ import { convertToVSCPaths, convertToDAPaths } from 'vs/workbench/parts/debug/co ...@@ -31,6 +31,7 @@ import { convertToVSCPaths, convertToDAPaths } from 'vs/workbench/parts/debug/co
import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService'; import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { CancellationToken } from 'vs/base/common/cancellation';
export class ExtHostDebugService implements ExtHostDebugServiceShape { export class ExtHostDebugService implements ExtHostDebugServiceShape {
...@@ -451,7 +452,7 @@ 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); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('no handler found')); return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('no handler found'));
...@@ -459,10 +460,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -459,10 +460,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.provideDebugConfigurations) { if (!handler.provideDebugConfigurations) {
return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('handler has no method 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); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration>(new Error('no handler found')); return TPromise.wrapError<vscode.DebugConfiguration>(new Error('no handler found'));
...@@ -470,10 +471,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -470,10 +471,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.resolveDebugConfiguration) { if (!handler.resolveDebugConfiguration) {
return TPromise.wrapError<vscode.DebugConfiguration>(new Error('handler has no method 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); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<vscode.DebugAdapterExecutable>(new Error('no handler found')); return TPromise.wrapError<vscode.DebugAdapterExecutable>(new Error('no handler found'));
...@@ -481,7 +482,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -481,7 +482,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!handler.debugAdapterExecutable) { if (!handler.debugAdapterExecutable) {
return TPromise.wrapError<vscode.DebugAdapterExecutable>(new Error('handler has no method 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> { public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration): Thenable<boolean> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册