@codingame/monaco-vscode-debug-service-override 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +2 -2
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +73 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1026 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +1004 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +337 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +432 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1039 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +649 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +64 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +636 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +740 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +408 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +80 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +169 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1271 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1330 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +115 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +77 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +307 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +31 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +387 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +267 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +817 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +131 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +142 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +262 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +669 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +709 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1002 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +352 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +129 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +734 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +501 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +162 -0
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +110 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +62 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +460 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +166 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +150 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +289 -0
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +64 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +311 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +29 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
5
|
+
import { equalsIgnoreCase } from 'vscode/vscode/vs/base/common/strings';
|
|
6
|
+
import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
7
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
8
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
9
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
10
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
11
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
12
|
+
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
13
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
|
+
import { Extensions } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
15
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
16
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
17
|
+
import { Breakpoints } from '../common/breakpoints.js';
|
|
18
|
+
import { CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_EXTENSION_AVAILABLE, INTERNAL_CONSOLE_OPTIONS_SCHEMA } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
19
|
+
import { Debugger } from '../common/debugger.js';
|
|
20
|
+
import { debuggersExtPoint, breakpointsExtPoint, launchSchema, presentationSchema } from '../common/debugSchemas.js';
|
|
21
|
+
import { TaskDefinitionRegistry } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskDefinitionRegistry';
|
|
22
|
+
import { launchSchemaId } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration';
|
|
23
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
24
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
25
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
26
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
27
|
+
|
|
28
|
+
const jsonRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
29
|
+
let AdapterManager = class AdapterManager extends Disposable {
|
|
30
|
+
constructor(delegate, editorService, configurationService, quickInputService, instantiationService, commandService, extensionService, contextKeyService, languageService, dialogService, lifecycleService) {
|
|
31
|
+
super();
|
|
32
|
+
this.editorService = editorService;
|
|
33
|
+
this.configurationService = configurationService;
|
|
34
|
+
this.quickInputService = quickInputService;
|
|
35
|
+
this.instantiationService = instantiationService;
|
|
36
|
+
this.commandService = commandService;
|
|
37
|
+
this.extensionService = extensionService;
|
|
38
|
+
this.contextKeyService = contextKeyService;
|
|
39
|
+
this.languageService = languageService;
|
|
40
|
+
this.dialogService = dialogService;
|
|
41
|
+
this.lifecycleService = lifecycleService;
|
|
42
|
+
this.debugAdapterFactories = ( new Map());
|
|
43
|
+
this._onDidRegisterDebugger = ( new Emitter());
|
|
44
|
+
this._onDidDebuggersExtPointRead = ( new Emitter());
|
|
45
|
+
this.breakpointContributions = [];
|
|
46
|
+
this.debuggerWhenKeys = ( new Set());
|
|
47
|
+
this.usedDebugTypes = ( new Set());
|
|
48
|
+
this.adapterDescriptorFactories = [];
|
|
49
|
+
this.debuggers = [];
|
|
50
|
+
this.registerListeners();
|
|
51
|
+
this.contextKeyService.bufferChangeEvents(() => {
|
|
52
|
+
this.debuggersAvailable = CONTEXT_DEBUGGERS_AVAILABLE.bindTo(contextKeyService);
|
|
53
|
+
this.debugExtensionsAvailable = CONTEXT_DEBUG_EXTENSION_AVAILABLE.bindTo(contextKeyService);
|
|
54
|
+
});
|
|
55
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
56
|
+
if (e.affectsSome(this.debuggerWhenKeys)) {
|
|
57
|
+
this.debuggersAvailable.set(this.hasEnabledDebuggers());
|
|
58
|
+
this.updateDebugAdapterSchema();
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
this._register(this.onDidDebuggersExtPointRead(() => {
|
|
62
|
+
this.debugExtensionsAvailable.set(this.debuggers.length > 0);
|
|
63
|
+
}));
|
|
64
|
+
this.lifecycleService.when(4 )
|
|
65
|
+
.then(() => this.debugExtensionsAvailable.set(this.debuggers.length > 0));
|
|
66
|
+
this._register(delegate.onDidNewSession(s => {
|
|
67
|
+
this.usedDebugTypes.add(s.configuration.type);
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
registerListeners() {
|
|
71
|
+
debuggersExtPoint.setHandler((extensions, delta) => {
|
|
72
|
+
delta.added.forEach(added => {
|
|
73
|
+
added.value.forEach(rawAdapter => {
|
|
74
|
+
if (!rawAdapter.type || (typeof rawAdapter.type !== 'string')) {
|
|
75
|
+
added.collector.error(( localizeWithPath(
|
|
76
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
77
|
+
'debugNoType',
|
|
78
|
+
"Debugger 'type' can not be omitted and must be of type 'string'."
|
|
79
|
+
)));
|
|
80
|
+
}
|
|
81
|
+
if (rawAdapter.type !== '*') {
|
|
82
|
+
const existing = this.getDebugger(rawAdapter.type);
|
|
83
|
+
if (existing) {
|
|
84
|
+
existing.merge(rawAdapter, added.description);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const dbg = this.instantiationService.createInstance(Debugger, this, rawAdapter, added.description);
|
|
88
|
+
dbg.when?.keys().forEach(key => this.debuggerWhenKeys.add(key));
|
|
89
|
+
this.debuggers.push(dbg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
extensions.forEach(extension => {
|
|
95
|
+
extension.value.forEach(rawAdapter => {
|
|
96
|
+
if (rawAdapter.type === '*') {
|
|
97
|
+
this.debuggers.forEach(dbg => dbg.merge(rawAdapter, extension.description));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
delta.removed.forEach(removed => {
|
|
102
|
+
const removedTypes = ( removed.value.map(rawAdapter => rawAdapter.type));
|
|
103
|
+
this.debuggers = this.debuggers.filter(d => removedTypes.indexOf(d.type) === -1);
|
|
104
|
+
});
|
|
105
|
+
this.updateDebugAdapterSchema();
|
|
106
|
+
this._onDidDebuggersExtPointRead.fire();
|
|
107
|
+
});
|
|
108
|
+
breakpointsExtPoint.setHandler(extensions => {
|
|
109
|
+
this.breakpointContributions = extensions.flatMap(ext => ( ext.value.map(
|
|
110
|
+
breakpoint => this.instantiationService.createInstance(Breakpoints, breakpoint)
|
|
111
|
+
)));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
updateDebugAdapterSchema() {
|
|
115
|
+
const items = launchSchema.properties['configurations'].items;
|
|
116
|
+
const taskSchema = TaskDefinitionRegistry.getJsonSchema();
|
|
117
|
+
const definitions = {
|
|
118
|
+
'common': {
|
|
119
|
+
properties: {
|
|
120
|
+
'name': {
|
|
121
|
+
type: 'string',
|
|
122
|
+
description: ( localizeWithPath(
|
|
123
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
124
|
+
'debugName',
|
|
125
|
+
"Name of configuration; appears in the launch configuration dropdown menu."
|
|
126
|
+
)),
|
|
127
|
+
default: 'Launch'
|
|
128
|
+
},
|
|
129
|
+
'debugServer': {
|
|
130
|
+
type: 'number',
|
|
131
|
+
description: ( localizeWithPath(
|
|
132
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
133
|
+
'debugServer',
|
|
134
|
+
"For debug extension development only: if a port is specified VS Code tries to connect to a debug adapter running in server mode"
|
|
135
|
+
)),
|
|
136
|
+
default: 4711
|
|
137
|
+
},
|
|
138
|
+
'preLaunchTask': {
|
|
139
|
+
anyOf: [taskSchema, {
|
|
140
|
+
type: ['string']
|
|
141
|
+
}],
|
|
142
|
+
default: '',
|
|
143
|
+
defaultSnippets: [{ body: { task: '', type: '' } }],
|
|
144
|
+
description: ( localizeWithPath(
|
|
145
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
146
|
+
'debugPrelaunchTask',
|
|
147
|
+
"Task to run before debug session starts."
|
|
148
|
+
))
|
|
149
|
+
},
|
|
150
|
+
'postDebugTask': {
|
|
151
|
+
anyOf: [taskSchema, {
|
|
152
|
+
type: ['string'],
|
|
153
|
+
}],
|
|
154
|
+
default: '',
|
|
155
|
+
defaultSnippets: [{ body: { task: '', type: '' } }],
|
|
156
|
+
description: ( localizeWithPath(
|
|
157
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
158
|
+
'debugPostDebugTask',
|
|
159
|
+
"Task to run after debug session ends."
|
|
160
|
+
))
|
|
161
|
+
},
|
|
162
|
+
'presentation': presentationSchema,
|
|
163
|
+
'internalConsoleOptions': INTERNAL_CONSOLE_OPTIONS_SCHEMA,
|
|
164
|
+
'suppressMultipleSessionWarning': {
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
description: ( localizeWithPath(
|
|
167
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
168
|
+
'suppressMultipleSessionWarning',
|
|
169
|
+
"Disable the warning when trying to start the same debug configuration more than once."
|
|
170
|
+
)),
|
|
171
|
+
default: true
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
launchSchema.definitions = definitions;
|
|
177
|
+
items.oneOf = [];
|
|
178
|
+
items.defaultSnippets = [];
|
|
179
|
+
this.debuggers.forEach(adapter => {
|
|
180
|
+
const schemaAttributes = adapter.getSchemaAttributes(definitions);
|
|
181
|
+
if (schemaAttributes && items.oneOf) {
|
|
182
|
+
items.oneOf.push(...schemaAttributes);
|
|
183
|
+
}
|
|
184
|
+
const configurationSnippets = adapter.configurationSnippets;
|
|
185
|
+
if (configurationSnippets && items.defaultSnippets) {
|
|
186
|
+
items.defaultSnippets.push(...configurationSnippets);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
jsonRegistry.registerSchema(launchSchemaId, launchSchema);
|
|
190
|
+
}
|
|
191
|
+
registerDebugAdapterFactory(debugTypes, debugAdapterLauncher) {
|
|
192
|
+
debugTypes.forEach(debugType => this.debugAdapterFactories.set(debugType, debugAdapterLauncher));
|
|
193
|
+
this.debuggersAvailable.set(this.hasEnabledDebuggers());
|
|
194
|
+
this._onDidRegisterDebugger.fire();
|
|
195
|
+
return {
|
|
196
|
+
dispose: () => {
|
|
197
|
+
debugTypes.forEach(debugType => this.debugAdapterFactories.delete(debugType));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
hasEnabledDebuggers() {
|
|
202
|
+
for (const [type] of this.debugAdapterFactories) {
|
|
203
|
+
const dbg = this.getDebugger(type);
|
|
204
|
+
if (dbg && dbg.enabled) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
createDebugAdapter(session) {
|
|
211
|
+
const factory = this.debugAdapterFactories.get(session.configuration.type);
|
|
212
|
+
if (factory) {
|
|
213
|
+
return factory.createDebugAdapter(session);
|
|
214
|
+
}
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
substituteVariables(debugType, folder, config) {
|
|
218
|
+
const factory = this.debugAdapterFactories.get(debugType);
|
|
219
|
+
if (factory) {
|
|
220
|
+
return factory.substituteVariables(folder, config);
|
|
221
|
+
}
|
|
222
|
+
return Promise.resolve(config);
|
|
223
|
+
}
|
|
224
|
+
runInTerminal(debugType, args, sessionId) {
|
|
225
|
+
const factory = this.debugAdapterFactories.get(debugType);
|
|
226
|
+
if (factory) {
|
|
227
|
+
return factory.runInTerminal(args, sessionId);
|
|
228
|
+
}
|
|
229
|
+
return Promise.resolve(void 0);
|
|
230
|
+
}
|
|
231
|
+
registerDebugAdapterDescriptorFactory(debugAdapterProvider) {
|
|
232
|
+
this.adapterDescriptorFactories.push(debugAdapterProvider);
|
|
233
|
+
return {
|
|
234
|
+
dispose: () => {
|
|
235
|
+
this.unregisterDebugAdapterDescriptorFactory(debugAdapterProvider);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
unregisterDebugAdapterDescriptorFactory(debugAdapterProvider) {
|
|
240
|
+
const ix = this.adapterDescriptorFactories.indexOf(debugAdapterProvider);
|
|
241
|
+
if (ix >= 0) {
|
|
242
|
+
this.adapterDescriptorFactories.splice(ix, 1);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
getDebugAdapterDescriptor(session) {
|
|
246
|
+
const config = session.configuration;
|
|
247
|
+
const providers = this.adapterDescriptorFactories.filter(p => p.type === config.type && p.createDebugAdapterDescriptor);
|
|
248
|
+
if (providers.length === 1) {
|
|
249
|
+
return providers[0].createDebugAdapterDescriptor(session);
|
|
250
|
+
}
|
|
251
|
+
return Promise.resolve(undefined);
|
|
252
|
+
}
|
|
253
|
+
getDebuggerLabel(type) {
|
|
254
|
+
const dbgr = this.getDebugger(type);
|
|
255
|
+
if (dbgr) {
|
|
256
|
+
return dbgr.label;
|
|
257
|
+
}
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
get onDidRegisterDebugger() {
|
|
261
|
+
return this._onDidRegisterDebugger.event;
|
|
262
|
+
}
|
|
263
|
+
get onDidDebuggersExtPointRead() {
|
|
264
|
+
return this._onDidDebuggersExtPointRead.event;
|
|
265
|
+
}
|
|
266
|
+
canSetBreakpointsIn(model) {
|
|
267
|
+
const languageId = model.getLanguageId();
|
|
268
|
+
if (!languageId || languageId === 'jsonc' || languageId === 'log') {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (this.configurationService.getValue('debug').allowBreakpointsEverywhere) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
return ( this.breakpointContributions.some(breakpoints => breakpoints.language === languageId && breakpoints.enabled));
|
|
275
|
+
}
|
|
276
|
+
getDebugger(type) {
|
|
277
|
+
return this.debuggers.find(dbg => equalsIgnoreCase(dbg.type, type));
|
|
278
|
+
}
|
|
279
|
+
getEnabledDebugger(type) {
|
|
280
|
+
const adapter = this.getDebugger(type);
|
|
281
|
+
return adapter && adapter.enabled ? adapter : undefined;
|
|
282
|
+
}
|
|
283
|
+
someDebuggerInterestedInLanguage(languageId) {
|
|
284
|
+
return !!this.debuggers
|
|
285
|
+
.filter(d => d.enabled)
|
|
286
|
+
.find(a => a.interestedInLanguage(languageId));
|
|
287
|
+
}
|
|
288
|
+
async guessDebugger(gettingConfigurations) {
|
|
289
|
+
const activeTextEditorControl = this.editorService.activeTextEditorControl;
|
|
290
|
+
let candidates = [];
|
|
291
|
+
let languageLabel = null;
|
|
292
|
+
let model = null;
|
|
293
|
+
if (isCodeEditor(activeTextEditorControl)) {
|
|
294
|
+
model = activeTextEditorControl.getModel();
|
|
295
|
+
const language = model ? model.getLanguageId() : undefined;
|
|
296
|
+
if (language) {
|
|
297
|
+
languageLabel = this.languageService.getLanguageName(language);
|
|
298
|
+
}
|
|
299
|
+
const adapters = this.debuggers
|
|
300
|
+
.filter(a => a.enabled)
|
|
301
|
+
.filter(a => language && a.interestedInLanguage(language));
|
|
302
|
+
if (adapters.length === 1) {
|
|
303
|
+
return adapters[0];
|
|
304
|
+
}
|
|
305
|
+
if (adapters.length > 1) {
|
|
306
|
+
candidates = adapters;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if ((!languageLabel || gettingConfigurations || (model && this.canSetBreakpointsIn(model))) && candidates.length === 0) {
|
|
310
|
+
await this.activateDebuggers('onDebugInitialConfigurations');
|
|
311
|
+
candidates = this.debuggers
|
|
312
|
+
.filter(a => a.enabled)
|
|
313
|
+
.filter(dbg => dbg.hasInitialConfiguration() || dbg.hasDynamicConfigurationProviders() || dbg.hasConfigurationProvider());
|
|
314
|
+
}
|
|
315
|
+
if (candidates.length === 0 && languageLabel) {
|
|
316
|
+
if (languageLabel.indexOf(' ') >= 0) {
|
|
317
|
+
languageLabel = `'${languageLabel}'`;
|
|
318
|
+
}
|
|
319
|
+
const { confirmed } = await this.dialogService.confirm({
|
|
320
|
+
type: Severity$1.Warning,
|
|
321
|
+
message: ( localizeWithPath(
|
|
322
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
323
|
+
'CouldNotFindLanguage',
|
|
324
|
+
"You don't have an extension for debugging {0}. Should we find a {0} extension in the Marketplace?",
|
|
325
|
+
languageLabel
|
|
326
|
+
)),
|
|
327
|
+
primaryButton: ( localizeWithPath(
|
|
328
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
329
|
+
{ key: 'findExtension', comment: ['&& denotes a mnemonic'] },
|
|
330
|
+
"&&Find {0} extension",
|
|
331
|
+
languageLabel
|
|
332
|
+
))
|
|
333
|
+
});
|
|
334
|
+
if (confirmed) {
|
|
335
|
+
await this.commandService.executeCommand('debug.installAdditionalDebuggers', languageLabel);
|
|
336
|
+
}
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
339
|
+
this.initExtensionActivationsIfNeeded();
|
|
340
|
+
candidates.sort((first, second) => first.label.localeCompare(second.label));
|
|
341
|
+
candidates = candidates.filter(a => !a.isHiddenFromDropdown);
|
|
342
|
+
const suggestedCandidates = [];
|
|
343
|
+
const otherCandidates = [];
|
|
344
|
+
candidates.forEach(d => {
|
|
345
|
+
const descriptor = d.getMainExtensionDescriptor();
|
|
346
|
+
if (descriptor.id && !!this.earlyActivatedExtensions?.has(descriptor.id)) {
|
|
347
|
+
suggestedCandidates.push(d);
|
|
348
|
+
}
|
|
349
|
+
else if (( this.usedDebugTypes.has(d.type))) {
|
|
350
|
+
suggestedCandidates.push(d);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
otherCandidates.push(d);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
const picks = [];
|
|
357
|
+
if (suggestedCandidates.length > 0) {
|
|
358
|
+
picks.push({ type: 'separator', label: ( localizeWithPath(
|
|
359
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
360
|
+
'suggestedDebuggers',
|
|
361
|
+
"Suggested"
|
|
362
|
+
)) }, ...( suggestedCandidates.map(c => ({ label: c.label, debugger: c }))));
|
|
363
|
+
}
|
|
364
|
+
if (otherCandidates.length > 0) {
|
|
365
|
+
if (picks.length > 0) {
|
|
366
|
+
picks.push({ type: 'separator', label: '' });
|
|
367
|
+
}
|
|
368
|
+
picks.push(...( otherCandidates.map(c => ({ label: c.label, debugger: c }))));
|
|
369
|
+
}
|
|
370
|
+
picks.push({ type: 'separator', label: '' }, { label: languageLabel ? ( localizeWithPath(
|
|
371
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
372
|
+
'installLanguage',
|
|
373
|
+
"Install an extension for {0}...",
|
|
374
|
+
languageLabel
|
|
375
|
+
)) : ( localizeWithPath(
|
|
376
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
377
|
+
'installExt',
|
|
378
|
+
"Install extension..."
|
|
379
|
+
)) });
|
|
380
|
+
const placeHolder = ( localizeWithPath(
|
|
381
|
+
'vs/workbench/contrib/debug/browser/debugAdapterManager',
|
|
382
|
+
'selectDebug',
|
|
383
|
+
"Select debugger"
|
|
384
|
+
));
|
|
385
|
+
return this.quickInputService.pick(picks, { activeItem: picks[0], placeHolder })
|
|
386
|
+
.then(picked => {
|
|
387
|
+
if (picked && picked.debugger) {
|
|
388
|
+
return picked.debugger;
|
|
389
|
+
}
|
|
390
|
+
if (picked) {
|
|
391
|
+
this.commandService.executeCommand('debug.installAdditionalDebuggers', languageLabel);
|
|
392
|
+
}
|
|
393
|
+
return undefined;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
initExtensionActivationsIfNeeded() {
|
|
397
|
+
if (!this.earlyActivatedExtensions) {
|
|
398
|
+
this.earlyActivatedExtensions = ( new Set());
|
|
399
|
+
const status = this.extensionService.getExtensionsStatus();
|
|
400
|
+
for (const id in status) {
|
|
401
|
+
if (!!status[id].activationTimes) {
|
|
402
|
+
this.earlyActivatedExtensions.add(id);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
async activateDebuggers(activationEvent, debugType) {
|
|
408
|
+
this.initExtensionActivationsIfNeeded();
|
|
409
|
+
const promises = [
|
|
410
|
+
this.extensionService.activateByEvent(activationEvent),
|
|
411
|
+
this.extensionService.activateByEvent('onDebug')
|
|
412
|
+
];
|
|
413
|
+
if (debugType) {
|
|
414
|
+
promises.push(this.extensionService.activateByEvent(`${activationEvent}:${debugType}`));
|
|
415
|
+
}
|
|
416
|
+
await Promise.all(promises);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
AdapterManager = ( __decorate([
|
|
420
|
+
( __param(1, IEditorService)),
|
|
421
|
+
( __param(2, IConfigurationService)),
|
|
422
|
+
( __param(3, IQuickInputService)),
|
|
423
|
+
( __param(4, IInstantiationService)),
|
|
424
|
+
( __param(5, ICommandService)),
|
|
425
|
+
( __param(6, IExtensionService)),
|
|
426
|
+
( __param(7, IContextKeyService)),
|
|
427
|
+
( __param(8, ILanguageService)),
|
|
428
|
+
( __param(9, IDialogService)),
|
|
429
|
+
( __param(10, ILifecycleService))
|
|
430
|
+
], AdapterManager));
|
|
431
|
+
|
|
432
|
+
export { AdapterManager };
|