From e1e3051d28f430c6e6096f4f0d21554232ccccb0 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Mon, 24 Jul 2017 11:23:30 +0200 Subject: [PATCH] add root folder to startDebugSession --- src/vs/vscode.d.ts | 6 ++++-- .../api/electron-browser/mainThreadDebugService.ts | 4 ++-- src/vs/workbench/api/node/extHost.api.impl.ts | 4 ++-- src/vs/workbench/api/node/extHost.protocol.ts | 4 ++-- src/vs/workbench/api/node/extHostDebugService.ts | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index ee6ef5dcd0b..924747280f9 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5469,12 +5469,14 @@ declare module 'vscode' { /** * Start a debug session based on the given configuration. - * The configuration's type is used to select the debug adapter and then is directly passed to the adapter without modification. + * The configuration's type is used to select the debug adapter and then the configuration is directly passed to this adapter. * This function should only be called in the context of a 'startSession' command, e.g. after verifying or massaging the configuration. + * Folder specific variables used in the configuration (e.g. '${workspaceRoot}') are resolved against the given folder. + * @param folder The workspace folder for resolving variables used in the configuration or undefined. * @param configuration The debug configuration that is directly passed to the debug adapter. * @return A thenable that resolves when the debug session could be successfully started. */ - export function startDebugSession(configuration: DebugConfiguration): Thenable; + export function startDebugSession(folder: WorkspaceFolder | undefined, configuration: DebugConfiguration): Thenable; /** * The currently active debug session or `undefined`. The active debug session is the one diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index 26fb0e58715..a1d7ac57cda 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -45,7 +45,7 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape { this._toDispose = dispose(this._toDispose); } - public $startDebugging(folder: URI | undefined, nameOrConfiguration: string | IConfig): TPromise { + public $startDebugging(folderUri: URI | undefined, nameOrConfiguration: string | IConfig): TPromise { return this.debugService.startDebugging(nameOrConfiguration).then(x => { return true; }, err => { @@ -53,7 +53,7 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape { }); } - public $startDebugSession(configuration: IConfig): TPromise { + public $startDebugSession(folderUri: URI | undefined, configuration: IConfig): TPromise { if (configuration.request !== 'launch' && configuration.request !== 'attach') { return TPromise.wrapError(new Error(`only 'launch' or 'attach' allowed for 'request' attribute`)); } diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 2a0a102ad37..47faf979b19 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -475,8 +475,8 @@ export function createApiFactory( startDebugging: proposedApiFunction(extension, (folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) => { return extHostDebugService.startDebugging(folder, nameOrConfig); }), - startDebugSession(config: vscode.DebugConfiguration) { - return extHostDebugService.startDebugSession(config); + startDebugSession(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration) { + return extHostDebugService.startDebugSession(folder, config); }, onDidStartDebugSession(listener, thisArg?, disposables?) { return extHostDebugService.onDidStartDebugSession(listener, thisArg, disposables); diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index ec8445406fc..87eaf556a12 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -347,8 +347,8 @@ export abstract class MainThreadSCMShape { export type DebugSessionUUID = string; export abstract class MainThreadDebugServiceShape { - $startDebugging(folder: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise { throw ni(); } - $startDebugSession(config: vscode.DebugConfiguration): TPromise { 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(); } } diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index bfb120cd91e..0e35c3afa56 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -51,9 +51,9 @@ export class ExtHostDebugService extends ExtHostDebugServiceShape { return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig); } - public startDebugSession(config: vscode.DebugConfiguration): TPromise { + public startDebugSession(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration): TPromise { - return this._debugServiceProxy.$startDebugSession(config).then((id: DebugSessionUUID) => { + return this._debugServiceProxy.$startDebugSession(folder ? folder.uri : undefined, config).then((id: DebugSessionUUID) => { const debugSession = new ExtHostDebugSession(this._debugServiceProxy, id, config.type, config.name); this._debugSessions.set(id, debugSession); return debugSession; -- GitLab