@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.
Files changed (60) hide show
  1. package/debug.js +4 -4
  2. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  3. package/external/tslib/tslib.es6.js +11 -0
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +73 -0
  7. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1026 -0
  8. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +1004 -0
  9. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
  10. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +337 -0
  11. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +432 -0
  12. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1039 -0
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +649 -0
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +64 -0
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +636 -0
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +740 -0
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +408 -0
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +80 -0
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +169 -0
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1271 -0
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1330 -0
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +115 -0
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +77 -0
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +307 -0
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +31 -0
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +387 -0
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +267 -0
  29. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +817 -0
  30. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +131 -0
  31. package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +142 -0
  32. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +262 -0
  33. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +669 -0
  34. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
  35. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
  36. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
  37. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
  38. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
  39. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
  40. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +709 -0
  41. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1002 -0
  42. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
  43. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +352 -0
  44. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +129 -0
  45. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +734 -0
  46. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +501 -0
  47. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +162 -0
  48. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
  49. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
  50. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +110 -0
  51. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +62 -0
  52. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +460 -0
  53. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +166 -0
  54. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
  55. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +150 -0
  56. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +289 -0
  57. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +87 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +64 -0
  59. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +311 -0
  60. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +29 -0
@@ -0,0 +1,347 @@
1
+ import { RGBA, Color } from 'vscode/vscode/vs/base/common/color';
2
+ import { ansiColorIdentifiers } from 'vscode/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
3
+
4
+ function handleANSIOutput(text, linkDetector, themeService, workspaceFolder) {
5
+ const root = document.createElement('span');
6
+ const textLength = text.length;
7
+ let styleNames = [];
8
+ let customFgColor;
9
+ let customBgColor;
10
+ let customUnderlineColor;
11
+ let colorsInverted = false;
12
+ let currentPos = 0;
13
+ let buffer = '';
14
+ while (currentPos < textLength) {
15
+ let sequenceFound = false;
16
+ if (text.charCodeAt(currentPos) === 27 && text.charAt(currentPos + 1) === '[') {
17
+ const startPos = currentPos;
18
+ currentPos += 2;
19
+ let ansiSequence = '';
20
+ while (currentPos < textLength) {
21
+ const char = text.charAt(currentPos);
22
+ ansiSequence += char;
23
+ currentPos++;
24
+ if (char.match(/^[ABCDHIJKfhmpsu]$/)) {
25
+ sequenceFound = true;
26
+ break;
27
+ }
28
+ }
29
+ if (sequenceFound) {
30
+ appendStylizedStringToContainer(root, buffer, styleNames, linkDetector, workspaceFolder, customFgColor, customBgColor, customUnderlineColor);
31
+ buffer = '';
32
+ if (ansiSequence.match(/^(?:[34][0-8]|9[0-7]|10[0-7]|[0-9]|2[1-5,7-9]|[34]9|5[8,9]|1[0-9])(?:;[349][0-7]|10[0-7]|[013]|[245]|[34]9)?(?:;[012]?[0-9]?[0-9])*;?m$/)) {
33
+ const styleCodes = ( ansiSequence.slice(0, -1)
34
+ .split(';')
35
+ .filter(elem => elem !== '')
36
+ .map(elem => parseInt(elem, 10)));
37
+ if (styleCodes[0] === 38 || styleCodes[0] === 48 || styleCodes[0] === 58) {
38
+ const colorType = (styleCodes[0] === 38) ? 'foreground' : ((styleCodes[0] === 48) ? 'background' : 'underline');
39
+ if (styleCodes[1] === 5) {
40
+ set8BitColor(styleCodes, colorType);
41
+ }
42
+ else if (styleCodes[1] === 2) {
43
+ set24BitColor(styleCodes, colorType);
44
+ }
45
+ }
46
+ else {
47
+ setBasicFormatters(styleCodes);
48
+ }
49
+ }
50
+ }
51
+ else {
52
+ currentPos = startPos;
53
+ }
54
+ }
55
+ if (sequenceFound === false) {
56
+ buffer += text.charAt(currentPos);
57
+ currentPos++;
58
+ }
59
+ }
60
+ if (buffer) {
61
+ appendStylizedStringToContainer(root, buffer, styleNames, linkDetector, workspaceFolder, customFgColor, customBgColor, customUnderlineColor);
62
+ }
63
+ return root;
64
+ function changeColor(colorType, color) {
65
+ if (colorType === 'foreground') {
66
+ customFgColor = color;
67
+ }
68
+ else if (colorType === 'background') {
69
+ customBgColor = color;
70
+ }
71
+ else if (colorType === 'underline') {
72
+ customUnderlineColor = color;
73
+ }
74
+ styleNames = styleNames.filter(style => style !== `code-${colorType}-colored`);
75
+ if (color !== undefined) {
76
+ styleNames.push(`code-${colorType}-colored`);
77
+ }
78
+ }
79
+ function reverseForegroundAndBackgroundColors() {
80
+ const oldFgColor = customFgColor;
81
+ changeColor('foreground', customBgColor);
82
+ changeColor('background', oldFgColor);
83
+ }
84
+ function setBasicFormatters(styleCodes) {
85
+ for (const code of styleCodes) {
86
+ switch (code) {
87
+ case 0: {
88
+ styleNames = [];
89
+ customFgColor = undefined;
90
+ customBgColor = undefined;
91
+ break;
92
+ }
93
+ case 1: {
94
+ styleNames = styleNames.filter(style => style !== `code-bold`);
95
+ styleNames.push('code-bold');
96
+ break;
97
+ }
98
+ case 2: {
99
+ styleNames = styleNames.filter(style => style !== `code-dim`);
100
+ styleNames.push('code-dim');
101
+ break;
102
+ }
103
+ case 3: {
104
+ styleNames = styleNames.filter(style => style !== `code-italic`);
105
+ styleNames.push('code-italic');
106
+ break;
107
+ }
108
+ case 4: {
109
+ styleNames = styleNames.filter(style => (style !== `code-underline` && style !== `code-double-underline`));
110
+ styleNames.push('code-underline');
111
+ break;
112
+ }
113
+ case 5: {
114
+ styleNames = styleNames.filter(style => style !== `code-blink`);
115
+ styleNames.push('code-blink');
116
+ break;
117
+ }
118
+ case 6: {
119
+ styleNames = styleNames.filter(style => style !== `code-rapid-blink`);
120
+ styleNames.push('code-rapid-blink');
121
+ break;
122
+ }
123
+ case 7: {
124
+ if (!colorsInverted) {
125
+ colorsInverted = true;
126
+ reverseForegroundAndBackgroundColors();
127
+ }
128
+ break;
129
+ }
130
+ case 8: {
131
+ styleNames = styleNames.filter(style => style !== `code-hidden`);
132
+ styleNames.push('code-hidden');
133
+ break;
134
+ }
135
+ case 9: {
136
+ styleNames = styleNames.filter(style => style !== `code-strike-through`);
137
+ styleNames.push('code-strike-through');
138
+ break;
139
+ }
140
+ case 10: {
141
+ styleNames = styleNames.filter(style => !style.startsWith('code-font'));
142
+ break;
143
+ }
144
+ case 11:
145
+ case 12:
146
+ case 13:
147
+ case 14:
148
+ case 15:
149
+ case 16:
150
+ case 17:
151
+ case 18:
152
+ case 19:
153
+ case 20: {
154
+ styleNames = styleNames.filter(style => !style.startsWith('code-font'));
155
+ styleNames.push(`code-font-${code - 10}`);
156
+ break;
157
+ }
158
+ case 21: {
159
+ styleNames = styleNames.filter(style => (style !== `code-underline` && style !== `code-double-underline`));
160
+ styleNames.push('code-double-underline');
161
+ break;
162
+ }
163
+ case 22: {
164
+ styleNames = styleNames.filter(style => (style !== `code-bold` && style !== `code-dim`));
165
+ break;
166
+ }
167
+ case 23: {
168
+ styleNames = styleNames.filter(style => (style !== `code-italic` && style !== `code-font-10`));
169
+ break;
170
+ }
171
+ case 24: {
172
+ styleNames = styleNames.filter(style => (style !== `code-underline` && style !== `code-double-underline`));
173
+ break;
174
+ }
175
+ case 25: {
176
+ styleNames = styleNames.filter(style => (style !== `code-blink` && style !== `code-rapid-blink`));
177
+ break;
178
+ }
179
+ case 27: {
180
+ if (colorsInverted) {
181
+ colorsInverted = false;
182
+ reverseForegroundAndBackgroundColors();
183
+ }
184
+ break;
185
+ }
186
+ case 28: {
187
+ styleNames = styleNames.filter(style => style !== `code-hidden`);
188
+ break;
189
+ }
190
+ case 29: {
191
+ styleNames = styleNames.filter(style => style !== `code-strike-through`);
192
+ break;
193
+ }
194
+ case 53: {
195
+ styleNames = styleNames.filter(style => style !== `code-overline`);
196
+ styleNames.push('code-overline');
197
+ break;
198
+ }
199
+ case 55: {
200
+ styleNames = styleNames.filter(style => style !== `code-overline`);
201
+ break;
202
+ }
203
+ case 39: {
204
+ changeColor('foreground', undefined);
205
+ break;
206
+ }
207
+ case 49: {
208
+ changeColor('background', undefined);
209
+ break;
210
+ }
211
+ case 59: {
212
+ changeColor('underline', undefined);
213
+ break;
214
+ }
215
+ case 73: {
216
+ styleNames = styleNames.filter(style => (style !== `code-superscript` && style !== `code-subscript`));
217
+ styleNames.push('code-superscript');
218
+ break;
219
+ }
220
+ case 74: {
221
+ styleNames = styleNames.filter(style => (style !== `code-superscript` && style !== `code-subscript`));
222
+ styleNames.push('code-subscript');
223
+ break;
224
+ }
225
+ case 75: {
226
+ styleNames = styleNames.filter(style => (style !== `code-superscript` && style !== `code-subscript`));
227
+ break;
228
+ }
229
+ default: {
230
+ setBasicColor(code);
231
+ break;
232
+ }
233
+ }
234
+ }
235
+ }
236
+ function set24BitColor(styleCodes, colorType) {
237
+ if (styleCodes.length >= 5 &&
238
+ styleCodes[2] >= 0 && styleCodes[2] <= 255 &&
239
+ styleCodes[3] >= 0 && styleCodes[3] <= 255 &&
240
+ styleCodes[4] >= 0 && styleCodes[4] <= 255) {
241
+ const customColor = ( new RGBA(styleCodes[2], styleCodes[3], styleCodes[4]));
242
+ changeColor(colorType, customColor);
243
+ }
244
+ }
245
+ function set8BitColor(styleCodes, colorType) {
246
+ let colorNumber = styleCodes[2];
247
+ const color = calcANSI8bitColor(colorNumber);
248
+ if (color) {
249
+ changeColor(colorType, color);
250
+ }
251
+ else if (colorNumber >= 0 && colorNumber <= 15) {
252
+ if (colorType === 'underline') {
253
+ const theme = themeService.getColorTheme();
254
+ const colorName = ansiColorIdentifiers[colorNumber];
255
+ const color = theme.getColor(colorName);
256
+ if (color) {
257
+ changeColor(colorType, color.rgba);
258
+ }
259
+ return;
260
+ }
261
+ colorNumber += 30;
262
+ if (colorNumber >= 38) {
263
+ colorNumber += 52;
264
+ }
265
+ if (colorType === 'background') {
266
+ colorNumber += 10;
267
+ }
268
+ setBasicColor(colorNumber);
269
+ }
270
+ }
271
+ function setBasicColor(styleCode) {
272
+ const theme = themeService.getColorTheme();
273
+ let colorType;
274
+ let colorIndex;
275
+ if (styleCode >= 30 && styleCode <= 37) {
276
+ colorIndex = styleCode - 30;
277
+ colorType = 'foreground';
278
+ }
279
+ else if (styleCode >= 90 && styleCode <= 97) {
280
+ colorIndex = (styleCode - 90) + 8;
281
+ colorType = 'foreground';
282
+ }
283
+ else if (styleCode >= 40 && styleCode <= 47) {
284
+ colorIndex = styleCode - 40;
285
+ colorType = 'background';
286
+ }
287
+ else if (styleCode >= 100 && styleCode <= 107) {
288
+ colorIndex = (styleCode - 100) + 8;
289
+ colorType = 'background';
290
+ }
291
+ if (colorIndex !== undefined && colorType) {
292
+ const colorName = ansiColorIdentifiers[colorIndex];
293
+ const color = theme.getColor(colorName);
294
+ if (color) {
295
+ changeColor(colorType, color.rgba);
296
+ }
297
+ }
298
+ }
299
+ }
300
+ function appendStylizedStringToContainer(root, stringContent, cssClasses, linkDetector, workspaceFolder, customTextColor, customBackgroundColor, customUnderlineColor) {
301
+ if (!root || !stringContent) {
302
+ return;
303
+ }
304
+ const container = linkDetector.linkify(stringContent, true, workspaceFolder);
305
+ container.className = cssClasses.join(' ');
306
+ if (customTextColor) {
307
+ container.style.color =
308
+ Color.Format.CSS.formatRGB(( new Color(customTextColor)));
309
+ }
310
+ if (customBackgroundColor) {
311
+ container.style.backgroundColor =
312
+ Color.Format.CSS.formatRGB(( new Color(customBackgroundColor)));
313
+ }
314
+ if (customUnderlineColor) {
315
+ container.style.textDecorationColor =
316
+ Color.Format.CSS.formatRGB(( new Color(customUnderlineColor)));
317
+ }
318
+ root.appendChild(container);
319
+ }
320
+ function calcANSI8bitColor(colorNumber) {
321
+ if (colorNumber % 1 !== 0) {
322
+ return;
323
+ }
324
+ if (colorNumber >= 16 && colorNumber <= 231) {
325
+ colorNumber -= 16;
326
+ let blue = colorNumber % 6;
327
+ colorNumber = (colorNumber - blue) / 6;
328
+ let green = colorNumber % 6;
329
+ colorNumber = (colorNumber - green) / 6;
330
+ let red = colorNumber;
331
+ const convFactor = 255 / 5;
332
+ blue = Math.round(blue * convFactor);
333
+ green = Math.round(green * convFactor);
334
+ red = Math.round(red * convFactor);
335
+ return ( new RGBA(red, green, blue));
336
+ }
337
+ else if (colorNumber >= 232 && colorNumber <= 255) {
338
+ colorNumber -= 232;
339
+ const colorLevel = Math.round(colorNumber / 23 * 255);
340
+ return ( new RGBA(colorLevel, colorLevel, colorLevel));
341
+ }
342
+ else {
343
+ return;
344
+ }
345
+ }
346
+
347
+ export { appendStylizedStringToContainer, calcANSI8bitColor, handleANSIOutput };
@@ -0,0 +1,337 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { append, addDisposableListener, EventType, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
5
+ import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox';
6
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
7
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
8
+ import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
9
+ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
10
+ import { asCssVariable } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
11
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
12
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
13
+ import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
14
+ import { selectBorder, selectBackground } from 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
16
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
17
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
18
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
19
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
20
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
21
+ import { IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
22
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
23
+ import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
24
+ import { ADD_CONFIGURATION_ID } from './debugCommands.js';
25
+ import { BaseActionViewItem, SelectActionViewItem } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionViewItems';
26
+ import { debugStart } from 'vscode/vscode/vs/workbench/contrib/debug/browser/debugIcons';
27
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
28
+ import { defaultSelectBoxStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
29
+ import { setupCustomHover } from 'vscode/vscode/vs/base/browser/ui/hover/updatableHoverWidget';
30
+ import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
31
+
32
+ var StartDebugActionViewItem_1;
33
+ const $ = $$1;
34
+ let StartDebugActionViewItem = class StartDebugActionViewItem extends BaseActionViewItem {
35
+ static { StartDebugActionViewItem_1 = this; }
36
+ static { this.SEPARATOR = '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500'; }
37
+ constructor(context, action, options, debugService, configurationService, commandService, contextService, contextViewService, keybindingService) {
38
+ super(context, action, options);
39
+ this.context = context;
40
+ this.debugService = debugService;
41
+ this.configurationService = configurationService;
42
+ this.commandService = commandService;
43
+ this.contextService = contextService;
44
+ this.keybindingService = keybindingService;
45
+ this.debugOptions = [];
46
+ this.selected = 0;
47
+ this.providers = [];
48
+ this.toDispose = [];
49
+ this.selectBox = ( new SelectBox(
50
+ [],
51
+ -1,
52
+ contextViewService,
53
+ defaultSelectBoxStyles,
54
+ { ariaLabel: ( localizeWithPath(
55
+ 'vs/workbench/contrib/debug/browser/debugActionViewItems',
56
+ 'debugLaunchConfigurations',
57
+ 'Debug Launch Configurations'
58
+ )) }
59
+ ));
60
+ this.selectBox.setFocusable(false);
61
+ this.toDispose.push(this.selectBox);
62
+ this.registerListeners();
63
+ }
64
+ registerListeners() {
65
+ this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
66
+ if (e.affectsConfiguration('launch')) {
67
+ this.updateOptions();
68
+ }
69
+ }));
70
+ this.toDispose.push(this.debugService.getConfigurationManager().onDidSelectConfiguration(() => {
71
+ this.updateOptions();
72
+ }));
73
+ }
74
+ render(container) {
75
+ this.container = container;
76
+ container.classList.add('start-debug-action-item');
77
+ this.start = append(container, $(ThemeIcon.asCSSSelector(debugStart)));
78
+ const keybinding = this.keybindingService.lookupKeybinding(this.action.id)?.getLabel();
79
+ const keybindingLabel = keybinding ? ` (${keybinding})` : '';
80
+ const title = this.action.label + keybindingLabel;
81
+ this.toDispose.push(setupCustomHover(getDefaultHoverDelegate('mouse'), this.start, title));
82
+ this.start.setAttribute('role', 'button');
83
+ this.start.ariaLabel = title;
84
+ this.toDispose.push(addDisposableListener(this.start, EventType.CLICK, () => {
85
+ this.start.blur();
86
+ if (this.debugService.state !== 1 ) {
87
+ this.actionRunner.run(this.action, this.context);
88
+ }
89
+ }));
90
+ this.toDispose.push(addDisposableListener(this.start, EventType.MOUSE_DOWN, (e) => {
91
+ if (this.action.enabled && e.button === 0) {
92
+ this.start.classList.add('active');
93
+ }
94
+ }));
95
+ this.toDispose.push(addDisposableListener(this.start, EventType.MOUSE_UP, () => {
96
+ this.start.classList.remove('active');
97
+ }));
98
+ this.toDispose.push(addDisposableListener(this.start, EventType.MOUSE_OUT, () => {
99
+ this.start.classList.remove('active');
100
+ }));
101
+ this.toDispose.push(addDisposableListener(this.start, EventType.KEY_DOWN, (e) => {
102
+ const event = ( new StandardKeyboardEvent(e));
103
+ if (event.equals(17 )) {
104
+ this.start.tabIndex = -1;
105
+ this.selectBox.focus();
106
+ event.stopPropagation();
107
+ }
108
+ }));
109
+ this.toDispose.push(this.selectBox.onDidSelect(async (e) => {
110
+ const target = this.debugOptions[e.index];
111
+ const shouldBeSelected = target.handler ? await target.handler() : false;
112
+ if (shouldBeSelected) {
113
+ this.selected = e.index;
114
+ }
115
+ else {
116
+ this.selectBox.select(this.selected);
117
+ }
118
+ }));
119
+ const selectBoxContainer = $('.configuration');
120
+ this.selectBox.render(append(container, selectBoxContainer));
121
+ this.toDispose.push(addDisposableListener(selectBoxContainer, EventType.KEY_DOWN, (e) => {
122
+ const event = ( new StandardKeyboardEvent(e));
123
+ if (event.equals(15 )) {
124
+ this.selectBox.setFocusable(false);
125
+ this.start.tabIndex = 0;
126
+ this.start.focus();
127
+ event.stopPropagation();
128
+ }
129
+ }));
130
+ this.container.style.border = `1px solid ${asCssVariable(selectBorder)}`;
131
+ selectBoxContainer.style.borderLeft = `1px solid ${asCssVariable(selectBorder)}`;
132
+ this.container.style.backgroundColor = asCssVariable(selectBackground);
133
+ const configManager = this.debugService.getConfigurationManager();
134
+ const updateDynamicConfigs = () => configManager.getDynamicProviders().then(providers => {
135
+ if (providers.length !== this.providers.length) {
136
+ this.providers = providers;
137
+ this.updateOptions();
138
+ }
139
+ });
140
+ this.toDispose.push(configManager.onDidChangeConfigurationProviders(updateDynamicConfigs));
141
+ updateDynamicConfigs();
142
+ this.updateOptions();
143
+ }
144
+ setActionContext(context) {
145
+ this.context = context;
146
+ }
147
+ isEnabled() {
148
+ return true;
149
+ }
150
+ focus(fromRight) {
151
+ if (fromRight) {
152
+ this.selectBox.focus();
153
+ }
154
+ else {
155
+ this.start.tabIndex = 0;
156
+ this.start.focus();
157
+ }
158
+ }
159
+ blur() {
160
+ this.start.tabIndex = -1;
161
+ this.selectBox.blur();
162
+ this.container.blur();
163
+ }
164
+ setFocusable(focusable) {
165
+ if (focusable) {
166
+ this.start.tabIndex = 0;
167
+ }
168
+ else {
169
+ this.start.tabIndex = -1;
170
+ this.selectBox.setFocusable(false);
171
+ }
172
+ }
173
+ dispose() {
174
+ this.toDispose = dispose(this.toDispose);
175
+ super.dispose();
176
+ }
177
+ updateOptions() {
178
+ this.selected = 0;
179
+ this.debugOptions = [];
180
+ const manager = this.debugService.getConfigurationManager();
181
+ const inWorkspace = this.contextService.getWorkbenchState() === 3 ;
182
+ let lastGroup;
183
+ const disabledIdxs = [];
184
+ manager.getAllConfigurations().forEach(({ launch, name, presentation }) => {
185
+ if (lastGroup !== presentation?.group) {
186
+ lastGroup = presentation?.group;
187
+ if (this.debugOptions.length) {
188
+ this.debugOptions.push({ label: StartDebugActionViewItem_1.SEPARATOR, handler: () => Promise.resolve(false) });
189
+ disabledIdxs.push(this.debugOptions.length - 1);
190
+ }
191
+ }
192
+ if (name === manager.selectedConfiguration.name && launch === manager.selectedConfiguration.launch) {
193
+ this.selected = this.debugOptions.length;
194
+ }
195
+ const label = inWorkspace ? `${name} (${launch.name})` : name;
196
+ this.debugOptions.push({
197
+ label, handler: async () => {
198
+ await manager.selectConfiguration(launch, name);
199
+ return true;
200
+ }
201
+ });
202
+ });
203
+ manager.getRecentDynamicConfigurations().slice(0, 3).forEach(({ name, type }) => {
204
+ if (type === manager.selectedConfiguration.type && manager.selectedConfiguration.name === name) {
205
+ this.selected = this.debugOptions.length;
206
+ }
207
+ this.debugOptions.push({
208
+ label: name,
209
+ handler: async () => {
210
+ await manager.selectConfiguration(undefined, name, undefined, { type });
211
+ return true;
212
+ }
213
+ });
214
+ });
215
+ if (this.debugOptions.length === 0) {
216
+ this.debugOptions.push({ label: ( localizeWithPath(
217
+ 'vs/workbench/contrib/debug/browser/debugActionViewItems',
218
+ 'noConfigurations',
219
+ "No Configurations"
220
+ )), handler: async () => false });
221
+ }
222
+ this.debugOptions.push({ label: StartDebugActionViewItem_1.SEPARATOR, handler: () => Promise.resolve(false) });
223
+ disabledIdxs.push(this.debugOptions.length - 1);
224
+ this.providers.forEach(p => {
225
+ this.debugOptions.push({
226
+ label: `${p.label}...`,
227
+ handler: async () => {
228
+ const picked = await p.pick();
229
+ if (picked) {
230
+ await manager.selectConfiguration(picked.launch, picked.config.name, picked.config, { type: p.type });
231
+ return true;
232
+ }
233
+ return false;
234
+ }
235
+ });
236
+ });
237
+ manager.getLaunches().filter(l => !l.hidden).forEach(l => {
238
+ const label = inWorkspace ? ( localizeWithPath(
239
+ 'vs/workbench/contrib/debug/browser/debugActionViewItems',
240
+ "addConfigTo",
241
+ "Add Config ({0})...",
242
+ l.name
243
+ )) : ( localizeWithPath(
244
+ 'vs/workbench/contrib/debug/browser/debugActionViewItems',
245
+ 'addConfiguration',
246
+ "Add Configuration..."
247
+ ));
248
+ this.debugOptions.push({
249
+ label, handler: async () => {
250
+ await this.commandService.executeCommand(ADD_CONFIGURATION_ID, ( l.uri.toString()));
251
+ return false;
252
+ }
253
+ });
254
+ });
255
+ this.selectBox.setOptions(( this.debugOptions.map(
256
+ (data, index) => ({ text: data.label, isDisabled: disabledIdxs.indexOf(index) !== -1 })
257
+ )), this.selected);
258
+ }
259
+ };
260
+ StartDebugActionViewItem = StartDebugActionViewItem_1 = ( __decorate([
261
+ ( __param(3, IDebugService)),
262
+ ( __param(4, IConfigurationService)),
263
+ ( __param(5, ICommandService)),
264
+ ( __param(6, IWorkspaceContextService)),
265
+ ( __param(7, IContextViewService)),
266
+ ( __param(8, IKeybindingService))
267
+ ], StartDebugActionViewItem));
268
+ let FocusSessionActionViewItem = class FocusSessionActionViewItem extends SelectActionViewItem {
269
+ constructor(action, session, debugService, contextViewService, configurationService) {
270
+ super(null, action, [], -1, contextViewService, defaultSelectBoxStyles, { ariaLabel: ( localizeWithPath(
271
+ 'vs/workbench/contrib/debug/browser/debugActionViewItems',
272
+ 'debugSession',
273
+ 'Debug Session'
274
+ )) });
275
+ this.debugService = debugService;
276
+ this.configurationService = configurationService;
277
+ this._register(this.debugService.getViewModel().onDidFocusSession(() => {
278
+ const session = this.getSelectedSession();
279
+ if (session) {
280
+ const index = this.getSessions().indexOf(session);
281
+ this.select(index);
282
+ }
283
+ }));
284
+ this._register(this.debugService.onDidNewSession(session => {
285
+ const sessionListeners = [];
286
+ sessionListeners.push(session.onDidChangeName(() => this.update()));
287
+ sessionListeners.push(session.onDidEndAdapter(() => dispose(sessionListeners)));
288
+ this.update();
289
+ }));
290
+ this.getSessions().forEach(session => {
291
+ this._register(session.onDidChangeName(() => this.update()));
292
+ });
293
+ this._register(this.debugService.onDidEndSession(() => this.update()));
294
+ const selectedSession = session ? this.mapFocusedSessionToSelected(session) : undefined;
295
+ this.update(selectedSession);
296
+ }
297
+ getActionContext(_, index) {
298
+ return this.getSessions()[index];
299
+ }
300
+ update(session) {
301
+ if (!session) {
302
+ session = this.getSelectedSession();
303
+ }
304
+ const sessions = this.getSessions();
305
+ const names = ( sessions.map(s => {
306
+ const label = s.getLabel();
307
+ if (s.parentSession) {
308
+ return `\u00A0\u00A0${label}`;
309
+ }
310
+ return label;
311
+ }));
312
+ this.setOptions(( names.map(data => ({ text: data }))), session ? sessions.indexOf(session) : undefined);
313
+ }
314
+ getSelectedSession() {
315
+ const session = this.debugService.getViewModel().focusedSession;
316
+ return session ? this.mapFocusedSessionToSelected(session) : undefined;
317
+ }
318
+ getSessions() {
319
+ const showSubSessions = this.configurationService.getValue('debug').showSubSessionsInToolBar;
320
+ const sessions = this.debugService.getModel().getSessions();
321
+ return showSubSessions ? sessions : sessions.filter(s => !s.parentSession);
322
+ }
323
+ mapFocusedSessionToSelected(focusedSession) {
324
+ const showSubSessions = this.configurationService.getValue('debug').showSubSessionsInToolBar;
325
+ while (focusedSession.parentSession && !showSubSessions) {
326
+ focusedSession = focusedSession.parentSession;
327
+ }
328
+ return focusedSession;
329
+ }
330
+ };
331
+ FocusSessionActionViewItem = ( __decorate([
332
+ ( __param(2, IDebugService)),
333
+ ( __param(3, IContextViewService)),
334
+ ( __param(4, IConfigurationService))
335
+ ], FocusSessionActionViewItem));
336
+
337
+ export { FocusSessionActionViewItem, StartDebugActionViewItem };