diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 2ad31b6544b..79c14ff35e9 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -139,11 +139,14 @@ declare module 'vscode' { /** * Start debugging by using either a named launch or named compound configuration, * or by directly passing a DebugConfiguration. - * Before debugging starts, all unsaved files are saved and the launch configurations are up-to-date. + * The named configurations are looked up in '.vscode/launch.json' found in the given folder. + * Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date. + * Folder specific variables used in the configuration (e.g. 'workspaceRoot') are resolved against the given folder. + * @param folder The workspace folder for looking up named configurations and resolving variables or undefined. * @param nameOrConfiguration Either the name of a debug or compound configuration or a DebugConfiguration object. * @return A thenable that resolves when debugging could be successfully started. */ - export function startDebugging(nameOrConfiguration: string | DebugConfiguration): Thenable; + export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration): Thenable; } /** diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index 3956650a100..26fb0e58715 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import URI from 'vs/base/common/uri'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDebugService, IConfig } from 'vs/workbench/parts/debug/common/debug'; import { IThreadService } from 'vs/workbench/services/thread/common/threadService'; @@ -44,7 +45,7 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape { this._toDispose = dispose(this._toDispose); } - public $startDebugging(nameOrConfiguration: string | IConfig): TPromise { + public $startDebugging(folder: URI | undefined, nameOrConfiguration: string | IConfig): TPromise { return this.debugService.startDebugging(nameOrConfiguration).then(x => { return true; }, err => { diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index e6bfe3741ac..2a0a102ad37 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -472,8 +472,8 @@ export function createApiFactory( get activeDebugSession() { return extHostDebugService.activeDebugSession; }, - startDebugging: proposedApiFunction(extension, (nameOrConfig: string | vscode.DebugConfiguration) => { - return extHostDebugService.startDebugging(nameOrConfig); + startDebugging: proposedApiFunction(extension, (folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) => { + return extHostDebugService.startDebugging(folder, nameOrConfig); }), startDebugSession(config: vscode.DebugConfiguration) { return extHostDebugService.startDebugSession(config); diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index d0a34021bf9..ec8445406fc 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -347,7 +347,7 @@ export abstract class MainThreadSCMShape { export type DebugSessionUUID = string; export abstract class MainThreadDebugServiceShape { - $startDebugging(nameOrConfig: string | vscode.DebugConfiguration): TPromise { throw ni(); } + $startDebugging(folder: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise { throw ni(); } $startDebugSession(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 b9dc8d8b7e3..bfb120cd91e 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -11,6 +11,7 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic import { MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID } from 'vs/workbench/api/node/extHost.protocol'; import * as vscode from 'vscode'; +import URI from 'vs/base/common/uri'; export class ExtHostDebugService extends ExtHostDebugServiceShape { @@ -45,9 +46,9 @@ export class ExtHostDebugService extends ExtHostDebugServiceShape { this._debugServiceProxy = threadService.get(MainContext.MainThreadDebugService); } - public startDebugging(nameOrConfig: string | vscode.DebugConfiguration): TPromise { + public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise { - return this._debugServiceProxy.$startDebugging(nameOrConfig); + return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig); } public startDebugSession(config: vscode.DebugConfiguration): TPromise {