diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index d13a4db870161375942f4e09b3526524649adce7..757c7fcf6479993b6dddd217ae2c1c5b6bf1fd76 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -8,6 +8,7 @@ import uri from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import Event from 'vs/base/common/event'; import severity from 'vs/base/common/severity'; +import { IJSONSchemaSnippet } from 'vs/base/common/jsonSchema'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IModel as EditorIModel, IEditorContribution, IRange } from 'vs/editor/common/editorCommon'; import { Position } from 'vs/editor/common/core/position'; @@ -313,6 +314,7 @@ export interface IRawEnvAdapter { export interface IRawAdapter extends IRawEnvAdapter { enableBreakpointsFor?: { languageIds: string[] }; configurationAttributes?: any; + configurationSnippets?: IJSONSchemaSnippet[]; initialConfigurations?: any[] | string; variables: { [key: string]: string }; aiKey?: string; diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index 8375e8ef2b7b7c3698c13c28df96cd6c266a8e81..6e653b6da795d1e76ce1f0d7bb4bf2a8d77e7f31 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings'; import * as objects from 'vs/base/common/objects'; import * as paths from 'vs/base/common/paths'; import * as platform from 'vs/base/common/platform'; -import { IJSONSchema } from 'vs/base/common/jsonSchema'; +import { IJSONSchema, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema'; import { IRawAdapter } from 'vs/workbench/parts/debug/common/debug'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; @@ -72,6 +72,10 @@ export class Adapter { return this.rawAdapter.variables; } + public get configurationSnippets(): IJSONSchemaSnippet[] { + return this.rawAdapter.configurationSnippets; + } + public merge(secondRawAdapter: IRawAdapter, extensionDescription: IExtensionDescription): void { if (secondRawAdapter.program) { secondRawAdapter.program = paths.join(extensionDescription.extensionFolderPath, secondRawAdapter.program); diff --git a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts index 21a7b0bffe87a4589d92aeb30054ca7d1f594b1e..1c4af2c686bb7058df35dd5752b989e4dfe9da81 100644 --- a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts @@ -69,6 +69,10 @@ export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerE description: nls.localize('vscode.extension.contributes.debuggers.initialConfigurations', "Configurations for generating the initial \'launch.json\'."), type: ['array', 'string'], }, + configurationSnippets: { + description: nls.localize('vscode.extension.contributes.debuggers.configurationSnippets', "Snippets for adding new configurations in \'launch.json\'."), + type: 'object' + }, configurationAttributes: { description: nls.localize('vscode.extension.contributes.debuggers.configurationAttributes', "JSON schema configurations for validating \'launch.json\'."), type: 'object' @@ -142,6 +146,7 @@ const schema: IJSONSchema = { type: 'array', description: nls.localize('app.launch.json.configurations', "List of configurations. Add new configurations or edit existing ones by using IntelliSense."), items: { + defaultSnippets: [], 'type': 'object', oneOf: [] } @@ -198,12 +203,16 @@ export class ConfigurationManager implements debug.IConfigurationManager { }); }); - // update the schema to include all attributes and types from extensions. - // debug.schema.properties['configurations'].items.properties.type.enum = this.adapters.map(adapter => adapter.type); + // update the schema to include all attributes, snippets and types from extensions. this.adapters.forEach(adapter => { + const items = (schema.properties['configurations'].items); const schemaAttributes = adapter.getSchemaAttributes(); if (schemaAttributes) { - (schema.properties['configurations'].items).oneOf.push(...schemaAttributes); + items.oneOf.push(...schemaAttributes); + } + const configurationSnippets = adapter.configurationSnippets; + if (configurationSnippets) { + items.defaultSnippets.push(...configurationSnippets); } }); });