From b217ea1b1f23d461a76977e9cdbd03c9e54e5942 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 24 Nov 2016 14:57:40 +0100 Subject: [PATCH] debug compounds: "launches" -> "configurations" --- extensions/configuration-editing/src/extension.ts | 11 ++++++++++- src/vs/workbench/parts/debug/common/debug.ts | 2 +- .../parts/debug/electron-browser/debugService.ts | 4 ++-- .../parts/debug/node/debugConfigurationManager.ts | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/extensions/configuration-editing/src/extension.ts b/extensions/configuration-editing/src/extension.ts index 5bdb9d2c711..5d636d95abc 100644 --- a/extensions/configuration-editing/src/extension.ts +++ b/extensions/configuration-editing/src/extension.ts @@ -61,9 +61,12 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined) { const ranges: vscode.Range[] = []; let addPropertyAndValue = false; + let depthInArray = 0; visit(editor.document.getText(), { onObjectProperty: (property, offset, length) => { - addPropertyAndValue = property === 'version' || property === 'type' || property === 'request' || property === 'configurations' || property === 'compounds'; + // Decorate attributes which are unlikely to be edited by the user. + // Only decorate "configurations" if it is not inside an array (compounds have a configurations property which should not be decorated). + addPropertyAndValue = property === 'version' || property === 'type' || property === 'request' || property === 'compounds' || (property === 'configurations' && depthInArray === 0); if (addPropertyAndValue) { ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length))); } @@ -72,6 +75,12 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined) { if (addPropertyAndValue) { ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length))); } + }, + onArrayBegin: (offset: number, length: number) => { + depthInArray++; + }, + onArrayEnd: (offset: number, length: number) => { + depthInArray--; } }); diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 36c9e347203..458bb6e635f 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -303,7 +303,7 @@ export interface IConfig extends IEnvConfig { export interface ICompound { name: string; - launches: string[]; + configurations: string[]; } export interface IRawEnvAdapter { diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 19df08c0e4a..cc22ba0000d 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -552,11 +552,11 @@ export class DebugService implements debug.IDebugService { .then(() => { const compound = typeof configurationOrName === 'string' ? this.configurationManager.getCompound(configurationOrName) : null; if (compound) { - if (!compound.launches) { + if (!compound.configurations) { return TPromise.wrapError(new Error(nls.localize('compoundMustHaveConfigurationNames', "Compound must have \"configurationNames\" attribute set in order to start multiple configurations."))); } - return TPromise.join(compound.launches.map(name => this.createProcess(name))); + return TPromise.join(compound.configurations.map(name => this.createProcess(name))); } return this.configurationManager.getConfiguration(configurationOrName).then(configuration => { diff --git a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts index ac9fde17393..3e9645d0bab 100644 --- a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts @@ -131,7 +131,7 @@ export const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registe // debug general schema export const schemaId = 'vscode://schemas/launch'; -const defaultCompound: debug.ICompound = { name: 'Compound', launches: [] }; +const defaultCompound: debug.ICompound = { name: 'Compound', configurations: [] }; const schema: IJSONSchema = { id: schemaId, type: 'object', @@ -162,19 +162,19 @@ const schema: IJSONSchema = { description: nls.localize('app.launch.json.compounds', "List of compounds. Each compound references multiple configurations which will get launched together."), items: { type: 'object', - required: ['name', 'launches'], + required: ['name', 'configurations'], properties: { name: { type: 'string', description: nls.localize('app.launch.json.compound.name', "Name of compound. Appears in the launch configuration drop down menu.") }, - launches: { + configurations: { type: 'array', default: [], items: { type: 'string' }, - description: nls.localize('app.launch.json.compounds.launches', "Names of configurations that will be launched as part of this compound.") + description: nls.localize('app.launch.json.compounds.configurations', "Names of configurations that will be started as part of this compound.") } }, default: defaultCompound