Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/debug/common/debugSchemas.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as extensionsRegistry from '../../../services/extensions/common/extensionsRegistry.js';
7
import * as nls from '../../../../nls.js';
8
import { IDebuggerContribution, ICompound, IBreakpointContribution } from './debug.js';
9
import { launchSchemaId } from '../../../services/configuration/common/configuration.js';
10
import { IJSONSchema } from '../../../../base/common/jsonSchema.js';
11
import { inputsSchema } from '../../../services/configurationResolver/common/configurationResolverSchema.js';
12
import { Disposable } from '../../../../base/common/lifecycle.js';
13
import { Extensions, IExtensionFeatureTableRenderer, IExtensionFeaturesRegistry, IRenderedData, IRowData, ITableData } from '../../../services/extensionManagement/common/extensionFeatures.js';
14
import { IExtensionManifest } from '../../../../platform/extensions/common/extensions.js';
15
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
16
import { Registry } from '../../../../platform/registry/common/platform.js';
17
18
// debuggers extension point
19
export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<IDebuggerContribution[]>({
20
extensionPoint: 'debuggers',
21
defaultExtensionKind: ['workspace'],
22
jsonSchema: {
23
description: nls.localize('vscode.extension.contributes.debuggers', 'Contributes debug adapters.'),
24
type: 'array',
25
defaultSnippets: [{ body: [{ type: '' }] }],
26
items: {
27
additionalProperties: false,
28
type: 'object',
29
defaultSnippets: [{ body: { type: '', program: '', runtime: '' } }],
30
properties: {
31
type: {
32
description: nls.localize('vscode.extension.contributes.debuggers.type', "Unique identifier for this debug adapter."),
33
type: 'string'
34
},
35
label: {
36
description: nls.localize('vscode.extension.contributes.debuggers.label', "Display name for this debug adapter."),
37
type: 'string'
38
},
39
program: {
40
description: nls.localize('vscode.extension.contributes.debuggers.program', "Path to the debug adapter program. Path is either absolute or relative to the extension folder."),
41
type: 'string'
42
},
43
args: {
44
description: nls.localize('vscode.extension.contributes.debuggers.args', "Optional arguments to pass to the adapter."),
45
type: 'array'
46
},
47
runtime: {
48
description: nls.localize('vscode.extension.contributes.debuggers.runtime', "Optional runtime in case the program attribute is not an executable but requires a runtime."),
49
type: 'string'
50
},
51
runtimeArgs: {
52
description: nls.localize('vscode.extension.contributes.debuggers.runtimeArgs', "Optional runtime arguments."),
53
type: 'array'
54
},
55
variables: {
56
description: nls.localize('vscode.extension.contributes.debuggers.variables', "Mapping from interactive variables (e.g. ${action.pickProcess}) in `launch.json` to a command."),
57
type: 'object'
58
},
59
initialConfigurations: {
60
description: nls.localize('vscode.extension.contributes.debuggers.initialConfigurations', "Configurations for generating the initial \'launch.json\'."),
61
type: ['array', 'string'],
62
},
63
languages: {
64
description: nls.localize('vscode.extension.contributes.debuggers.languages', "List of languages for which the debug extension could be considered the \"default debugger\"."),
65
type: 'array'
66
},
67
configurationSnippets: {
68
description: nls.localize('vscode.extension.contributes.debuggers.configurationSnippets', "Snippets for adding new configurations in \'launch.json\'."),
69
type: 'array'
70
},
71
configurationAttributes: {
72
description: nls.localize('vscode.extension.contributes.debuggers.configurationAttributes', "JSON schema configurations for validating \'launch.json\'."),
73
type: 'object'
74
},
75
when: {
76
description: nls.localize('vscode.extension.contributes.debuggers.when', "Condition which must be true to enable this type of debugger. Consider using 'shellExecutionSupported', 'virtualWorkspace', 'resourceScheme' or an extension-defined context key as appropriate for this."),
77
type: 'string',
78
default: ''
79
},
80
hiddenWhen: {
81
description: nls.localize('vscode.extension.contributes.debuggers.hiddenWhen', "When this condition is true, this debugger type is hidden from the debugger list, but is still enabled."),
82
type: 'string',
83
default: ''
84
},
85
deprecated: {
86
description: nls.localize('vscode.extension.contributes.debuggers.deprecated', "Optional message to mark this debug type as being deprecated."),
87
type: 'string',
88
default: ''
89
},
90
windows: {
91
description: nls.localize('vscode.extension.contributes.debuggers.windows', "Windows specific settings."),
92
type: 'object',
93
properties: {
94
runtime: {
95
description: nls.localize('vscode.extension.contributes.debuggers.windows.runtime', "Runtime used for Windows."),
96
type: 'string'
97
}
98
}
99
},
100
osx: {
101
description: nls.localize('vscode.extension.contributes.debuggers.osx', "macOS specific settings."),
102
type: 'object',
103
properties: {
104
runtime: {
105
description: nls.localize('vscode.extension.contributes.debuggers.osx.runtime', "Runtime used for macOS."),
106
type: 'string'
107
}
108
}
109
},
110
linux: {
111
description: nls.localize('vscode.extension.contributes.debuggers.linux', "Linux specific settings."),
112
type: 'object',
113
properties: {
114
runtime: {
115
description: nls.localize('vscode.extension.contributes.debuggers.linux.runtime', "Runtime used for Linux."),
116
type: 'string'
117
}
118
}
119
},
120
strings: {
121
description: nls.localize('vscode.extension.contributes.debuggers.strings', "UI strings contributed by this debug adapter."),
122
type: 'object',
123
properties: {
124
unverifiedBreakpoints: {
125
description: nls.localize('vscode.extension.contributes.debuggers.strings.unverifiedBreakpoints', "When there are unverified breakpoints in a language supported by this debug adapter, this message will appear on the breakpoint hover and in the breakpoints view. Markdown and command links are supported."),
126
type: 'string'
127
}
128
}
129
}
130
}
131
}
132
}
133
});
134
135
// breakpoints extension point #9037
136
export const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<IBreakpointContribution[]>({
137
extensionPoint: 'breakpoints',
138
jsonSchema: {
139
description: nls.localize('vscode.extension.contributes.breakpoints', 'Contributes breakpoints.'),
140
type: 'array',
141
defaultSnippets: [{ body: [{ language: '' }] }],
142
items: {
143
type: 'object',
144
additionalProperties: false,
145
defaultSnippets: [{ body: { language: '' } }],
146
properties: {
147
language: {
148
description: nls.localize('vscode.extension.contributes.breakpoints.language', "Allow breakpoints for this language."),
149
type: 'string'
150
},
151
when: {
152
description: nls.localize('vscode.extension.contributes.breakpoints.when', "Condition which must be true to enable breakpoints in this language. Consider matching this to the debugger when clause as appropriate."),
153
type: 'string',
154
default: ''
155
}
156
}
157
}
158
}
159
});
160
161
// debug general schema
162
163
export const presentationSchema: IJSONSchema = {
164
type: 'object',
165
description: nls.localize('presentation', "Presentation options on how to show this configuration in the debug configuration dropdown and the command palette."),
166
properties: {
167
hidden: {
168
type: 'boolean',
169
default: false,
170
description: nls.localize('presentation.hidden', "Controls if this configuration should be shown in the configuration dropdown and the command palette.")
171
},
172
group: {
173
type: 'string',
174
default: '',
175
description: nls.localize('presentation.group', "Group that this configuration belongs to. Used for grouping and sorting in the configuration dropdown and the command palette.")
176
},
177
order: {
178
type: 'number',
179
default: 1,
180
description: nls.localize('presentation.order', "Order of this configuration within a group. Used for grouping and sorting in the configuration dropdown and the command palette.")
181
}
182
},
183
default: {
184
hidden: false,
185
group: '',
186
order: 1
187
}
188
};
189
const defaultCompound: ICompound = { name: 'Compound', configurations: [] };
190
export const launchSchema: IJSONSchema = {
191
id: launchSchemaId,
192
type: 'object',
193
title: nls.localize('app.launch.json.title', "Launch"),
194
allowTrailingCommas: true,
195
allowComments: true,
196
required: [],
197
default: { version: '0.2.0', configurations: [], compounds: [] },
198
properties: {
199
version: {
200
type: 'string',
201
description: nls.localize('app.launch.json.version', "Version of this file format."),
202
default: '0.2.0'
203
},
204
configurations: {
205
type: 'array',
206
description: nls.localize('app.launch.json.configurations', "List of configurations. Add new configurations or edit existing ones by using IntelliSense."),
207
items: {
208
defaultSnippets: [],
209
'type': 'object',
210
oneOf: []
211
}
212
},
213
compounds: {
214
type: 'array',
215
description: nls.localize('app.launch.json.compounds', "List of compounds. Each compound references multiple configurations which will get launched together."),
216
items: {
217
type: 'object',
218
required: ['name', 'configurations'],
219
properties: {
220
name: {
221
type: 'string',
222
description: nls.localize('app.launch.json.compound.name', "Name of compound. Appears in the launch configuration drop down menu.")
223
},
224
presentation: presentationSchema,
225
configurations: {
226
type: 'array',
227
default: [],
228
items: {
229
oneOf: [{
230
enum: [],
231
description: nls.localize('useUniqueNames', "Please use unique configuration names.")
232
}, {
233
type: 'object',
234
required: ['name'],
235
properties: {
236
name: {
237
enum: [],
238
description: nls.localize('app.launch.json.compound.name', "Name of compound. Appears in the launch configuration drop down menu.")
239
},
240
folder: {
241
enum: [],
242
description: nls.localize('app.launch.json.compound.folder', "Name of folder in which the compound is located.")
243
}
244
}
245
}]
246
},
247
description: nls.localize('app.launch.json.compounds.configurations', "Names of configurations that will be started as part of this compound.")
248
},
249
stopAll: {
250
type: 'boolean',
251
default: false,
252
description: nls.localize('app.launch.json.compound.stopAll', "Controls whether manually terminating one session will stop all of the compound sessions.")
253
},
254
preLaunchTask: {
255
type: 'string',
256
default: '',
257
description: nls.localize('compoundPrelaunchTask', "Task to run before any of the compound configurations start.")
258
}
259
},
260
default: defaultCompound
261
},
262
default: [
263
defaultCompound
264
]
265
},
266
inputs: inputsSchema.definitions!.inputs
267
}
268
};
269
270
class DebuggersDataRenderer extends Disposable implements IExtensionFeatureTableRenderer {
271
272
readonly type = 'table';
273
274
shouldRender(manifest: IExtensionManifest): boolean {
275
return !!manifest.contributes?.debuggers;
276
}
277
278
render(manifest: IExtensionManifest): IRenderedData<ITableData> {
279
const contrib = manifest.contributes?.debuggers || [];
280
if (!contrib.length) {
281
return { data: { headers: [], rows: [] }, dispose: () => { } };
282
}
283
284
const headers = [
285
nls.localize('debugger name', "Name"),
286
nls.localize('debugger type', "Type"),
287
];
288
289
const rows: IRowData[][] = contrib.map(d => {
290
return [
291
d.label ?? '',
292
d.type
293
];
294
});
295
296
return {
297
data: {
298
headers,
299
rows
300
},
301
dispose: () => { }
302
};
303
}
304
}
305
306
Registry.as<IExtensionFeaturesRegistry>(Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({
307
id: 'debuggers',
308
label: nls.localize('debuggers', "Debuggers"),
309
access: {
310
canToggle: false
311
},
312
renderer: new SyncDescriptor(DebuggersDataRenderer),
313
});
314
315
316