diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 428e3599291..58765023a73 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -370,7 +370,7 @@ export interface IRawAdapter extends IRawEnvAdapter { enableBreakpointsFor?: { languageIds: string[] }; configurationAttributes?: any; configurationSnippets?: IJSONSchemaSnippet[]; - initialConfigurations?: any[] | string; + initialConfigurations?: any[]; startSessionCommand?: string; languages?: string[]; variables?: { [key: string]: string }; diff --git a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts index 612d2a9edfb..be682b111c5 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts @@ -556,7 +556,7 @@ class Launch implements ILaunch { return this.configurationManager.guessAdapter(type).then(adapter => { if (adapter) { return this.configurationManager.provideDebugConfigurations(this.workspace.uri, adapter.type).then(initialConfigs => { - return adapter.getInitialConfigurationContent(this.workspace.uri, initialConfigs); + return adapter.getInitialConfigurationContent(initialConfigs); }); } else { return undefined; diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index a403b824a7c..e10a17619be 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -5,9 +5,7 @@ import fs = require('fs'); import path = require('path'); -import { parse } from 'vs/base/common/json'; 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'; @@ -142,32 +140,7 @@ export class Adapter { return !!this.rawAdapter.initialConfigurations; } - public getInitialConfigurationContent(folderUri: uri, initialConfigs?: IConfig[]): TPromise { - const editorConfig = this.configurationService.getConfiguration(); - - // deprecated code: use DebugConfigurationProvider instead of command - 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 - // TODO@Isidor stop supporting initialConfigurations - return this.commandService.executeCommand(this.rawAdapter.initialConfigurations, folderUri).then(content => { - // Debug adapter returned the full content of the launch.json - return it after format - try { - const config = parse(content); - config.configurations.push(...initialConfigs); - content = JSON.stringify(config, null, '\t').split('\n').map(line => '\t' + line).join('\n').trim(); - } catch (e) { - // noop - } - - if (editorConfig.editor && editorConfig.editor.insertSpaces) { - content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize)); - } - return content; - }); - } - // end of deprecation - + public getInitialConfigurationContent(initialConfigs?: IConfig[]): TPromise { // at this point we got some configs from the package.json and/or from registered DebugConfigurationProviders let initialConfigurations = this.rawAdapter.initialConfigurations || []; if (initialConfigs) { @@ -175,7 +148,6 @@ export class Adapter { } const configs = JSON.stringify(initialConfigurations, null, '\t').split('\n').map(line => '\t' + line).join('\n').trim(); - const comment1 = nls.localize('launch.config.comment1', "Use IntelliSense to learn about possible attributes."); const comment2 = nls.localize('launch.config.comment2', "Hover to view descriptions of existing attributes."); const comment3 = nls.localize('launch.config.comment3', "For more information, visit: {0}", 'https://go.microsoft.com/fwlink/?linkid=830387'); @@ -191,6 +163,7 @@ export class Adapter { ].join('\n'); // fix formatting + const editorConfig = this.configurationService.getConfiguration(); if (editorConfig.editor && editorConfig.editor.insertSpaces) { content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize)); } diff --git a/src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts b/src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts index e65f7aa5193..8a44c4dba3e 100644 --- a/src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts +++ b/src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts @@ -126,7 +126,7 @@ suite('Debug - Adapter', () => { ' ]', '}'].join('\n'); - return adapter.getInitialConfigurationContent(null).then(content => { + return adapter.getInitialConfigurationContent().then(content => { assert.equal(content, expected); }, err => assert.fail()); });