From 9769d31a3903f5410a39fffe7800a554ac4a5193 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Wed, 27 Jun 2018 22:52:36 +0200 Subject: [PATCH] support var substitution for multiroot workspace --- .../mainThreadDebugService.ts | 2 +- .../workbench/api/node/extHostDebugService.ts | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index f2159515af5..b98563c70b1 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -69,7 +69,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb } substituteVariables(folder: IWorkspaceFolder, config: IConfig): TPromise { - return this._proxy.$substituteVariables(folder.uri, config); + return this._proxy.$substituteVariables(folder ? folder.uri : undefined, config); } runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): TPromise { diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index d01e7dc7533..041ab383c13 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -166,15 +166,18 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { if (!this._variableResolver) { this._variableResolver = new ExtHostVariableResolverService(this._workspaceService, this._editorsService, this._configurationService); } + let ws: IWorkspaceFolder; const folder = this.getFolder(folderUri); - let ws: IWorkspaceFolder = { - uri: folder.uri, - name: folder.name, - index: folder.index, - toResource: () => { - throw new Error('Not implemented'); - } - }; + if (folder) { + ws = { + uri: folder.uri, + name: folder.name, + index: folder.index, + toResource: () => { + throw new Error('Not implemented'); + } + }; + } return asWinJsPromise(token => this._variableResolver.resolveAny(ws, config)); } @@ -524,7 +527,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { this._onDidReceiveDebugSessionCustomEvent.fire(ee); } - private getFolder(_folderUri: UriComponents | undefined): vscode.WorkspaceFolder { + private getFolder(_folderUri: UriComponents | undefined): vscode.WorkspaceFolder | undefined { if (_folderUri) { const folderURI = URI.revive(_folderUri); return this._workspaceService.resolveWorkspaceFolder(folderURI); -- GitLab