diff --git a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts index be87039d7be4318055fd50c3b72ba763caa4e0ab..3bce46d7bb006311c3c7172a2563e45f434aa2bc 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts @@ -349,8 +349,15 @@ export class ConfigurationManager implements IConfigurationManager { const resource = this.configFileUri; let configFileCreated = false; + // temporary workaround: the folderUri should be an argument to openConfigFile + let folderUri: uri = undefined; + const workspace = this.contextService.getWorkspace(); + if (workspace && workspace.roots.length > 0) { + folderUri = workspace.roots[0]; + } + return this.fileService.resolveContent(resource).then(content => true, err => - this.guessAdapter(type).then(adapter => adapter ? adapter.getInitialConfigurationContent() : undefined) + this.guessAdapter(type).then(adapter => adapter ? adapter.getInitialConfigurationContent(folderUri) : undefined) .then(content => { if (!content) { return false; diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index 4deae35b1b0c3ec79f9fac172add85ef46e861bc..944fd5b52277869c82fefd16a62a5a3fcb9d64dd 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -6,6 +6,7 @@ import fs = require('fs'); import path = require('path'); import * as nls from 'vs/nls'; +import uri from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import * as strings from 'vs/base/common/strings'; import * as objects from 'vs/base/common/objects'; @@ -139,12 +140,12 @@ export class Adapter { return !!this.rawAdapter.initialConfigurations; } - public getInitialConfigurationContent(): TPromise { + public getInitialConfigurationContent(folderUri: uri): TPromise { const editorConfig = this.configurationService.getConfiguration(); if (typeof this.rawAdapter.initialConfigurations === 'string') { // Contributed initialConfigurations is a command that needs to be invoked // Debug adapter will dynamically provide the full launch.json - return this.commandService.executeCommand(this.rawAdapter.initialConfigurations).then(content => { + return this.commandService.executeCommand(this.rawAdapter.initialConfigurations, folderUri).then(content => { // Debug adapter returned the full content of the launch.json - return it after format if (editorConfig.editor.insertSpaces) { content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize));