@codingame/monaco-vscode-debug-service-override 1.82.4 → 1.82.5-next.1

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 (73) hide show
  1. package/debug.d.ts +5 -0
  2. package/debug.js +24 -0
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  4. package/external/tslib/tslib.es6.js +11 -0
  5. package/index.d.ts +1 -1
  6. package/index.js +1 -1
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +2 -2
  9. package/vscode/src/vs/editor/common/services/languageFeaturesService.js +44 -0
  10. package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +200 -0
  11. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +785 -0
  12. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +399 -0
  13. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1298 -0
  14. package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
  15. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +960 -0
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +497 -0
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +299 -0
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +400 -0
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +827 -0
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +621 -0
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +60 -0
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +527 -0
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +681 -0
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +356 -0
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +82 -0
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +143 -0
  29. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1174 -0
  30. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1144 -0
  31. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +106 -0
  32. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +68 -0
  33. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +275 -0
  34. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +314 -0
  35. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +168 -0
  36. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +663 -0
  37. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +105 -0
  38. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +231 -0
  39. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +631 -0
  40. package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +6 -0
  41. package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +6 -0
  42. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
  43. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
  44. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
  45. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
  46. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
  47. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
  48. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +695 -0
  49. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +953 -0
  50. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
  51. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +336 -0
  52. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +98 -0
  53. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +575 -0
  54. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +415 -0
  55. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +102 -0
  56. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
  57. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
  58. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +100 -0
  59. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +59 -0
  60. package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1482 -0
  61. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +346 -0
  62. package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +123 -0
  63. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +175 -0
  64. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
  65. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +117 -0
  66. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +260 -0
  67. package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +27 -0
  68. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +83 -0
  69. package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +283 -0
  70. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +305 -0
  71. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +28 -0
  72. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +176 -0
  73. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +12 -0
@@ -0,0 +1,575 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { HighlightedLabel } from 'monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js';
4
+ import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
5
+ import { timeout, RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
6
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
7
+ import { createMatches } from 'monaco-editor/esm/vs/base/common/filters.js';
8
+ import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
9
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
10
+ import { createAndFillInContextMenuActions } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
11
+ import { MenuId, registerAction2, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
12
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
13
+ import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
14
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
15
+ import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
16
+ import { IContextMenuService, IContextViewService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
17
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
18
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
19
+ import { WorkbenchAsyncDataTree } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
20
+ import { INotificationService, Severity } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
21
+ import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
22
+ import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
23
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
24
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
25
+ import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
26
+ import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
27
+ import { AbstractExpressionsRenderer, renderVariable, renderViewTree } from './baseDebugView.js';
28
+ import { LinkDetector } from './linkDetector.js';
29
+ import { IDebugService, VARIABLES_VIEW_ID, CONTEXT_VARIABLES_FOCUSED, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED, CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED, CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, CONTEXT_CAN_VIEW_MEMORY, CONTEXT_VARIABLE_IS_READONLY } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
30
+ import { Variable, getUriForDebugMemory, Expression, ErrorScope, Scope, StackFrame } from '../common/debugModel.js';
31
+ import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
32
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
33
+
34
+ var VariablesRenderer_1;
35
+ const $ = dom.$;
36
+ let forgetScopes = true;
37
+ let variableInternalContext;
38
+ let dataBreakpointInfoResponse;
39
+ let VariablesView = class VariablesView extends ViewPane {
40
+ constructor(options, contextMenuService, debugService, keybindingService, configurationService, instantiationService, viewDescriptorService, contextKeyService, openerService, themeService, telemetryService, menuService) {
41
+ super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
42
+ this.debugService = debugService;
43
+ this.menuService = menuService;
44
+ this.needsRefresh = false;
45
+ this.savedViewState = ( new Map());
46
+ this.autoExpandedScopes = ( new Set());
47
+ this.updateTreeScheduler = ( new RunOnceScheduler(async () => {
48
+ const stackFrame = this.debugService.getViewModel().focusedStackFrame;
49
+ this.needsRefresh = false;
50
+ const input = this.tree.getInput();
51
+ if (input) {
52
+ this.savedViewState.set(input.getId(), this.tree.getViewState());
53
+ }
54
+ if (!stackFrame) {
55
+ await this.tree.setInput(null);
56
+ return;
57
+ }
58
+ const viewState = this.savedViewState.get(stackFrame.getId());
59
+ await this.tree.setInput(stackFrame, viewState);
60
+ const scopes = await stackFrame.getScopes();
61
+ const toExpand = scopes.find(s => !s.expensive);
62
+ if (toExpand && this.tree.hasNode(toExpand)) {
63
+ this.autoExpandedScopes.add(toExpand.getId());
64
+ await this.tree.expand(toExpand);
65
+ }
66
+ }, 400));
67
+ }
68
+ renderBody(container) {
69
+ super.renderBody(container);
70
+ this.element.classList.add('debug-pane');
71
+ container.classList.add('debug-variables');
72
+ const treeContainer = renderViewTree(container);
73
+ const linkeDetector = this.instantiationService.createInstance(LinkDetector);
74
+ this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'VariablesView', treeContainer, ( new VariablesDelegate()), [this.instantiationService.createInstance(VariablesRenderer, linkeDetector), ( new ScopesRenderer()), ( new ScopeErrorRenderer())], ( new VariablesDataSource()), {
75
+ accessibilityProvider: ( new VariablesAccessibilityProvider()),
76
+ identityProvider: { getId: (element) => element.getId() },
77
+ keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e) => e.name },
78
+ overrideStyles: {
79
+ listBackground: this.getBackgroundColor()
80
+ }
81
+ });
82
+ this.tree.setInput(this.debugService.getViewModel().focusedStackFrame ?? null);
83
+ CONTEXT_VARIABLES_FOCUSED.bindTo(this.tree.contextKeyService);
84
+ this._register(this.debugService.getViewModel().onDidFocusStackFrame(sf => {
85
+ if (!this.isBodyVisible()) {
86
+ this.needsRefresh = true;
87
+ return;
88
+ }
89
+ const timeout = sf.explicit ? 0 : undefined;
90
+ this.updateTreeScheduler.schedule(timeout);
91
+ }));
92
+ this._register(this.debugService.getViewModel().onWillUpdateViews(() => {
93
+ const stackFrame = this.debugService.getViewModel().focusedStackFrame;
94
+ if (stackFrame && forgetScopes) {
95
+ stackFrame.forgetScopes();
96
+ }
97
+ forgetScopes = true;
98
+ this.tree.updateChildren();
99
+ }));
100
+ this._register(this.tree.onMouseDblClick(e => this.onMouseDblClick(e)));
101
+ this._register(this.tree.onContextMenu(async (e) => await this.onContextMenu(e)));
102
+ this._register(this.onDidChangeBodyVisibility(visible => {
103
+ if (visible && this.needsRefresh) {
104
+ this.updateTreeScheduler.schedule();
105
+ }
106
+ }));
107
+ let horizontalScrolling;
108
+ this._register(this.debugService.getViewModel().onDidSelectExpression(e => {
109
+ const variable = e?.expression;
110
+ if (variable instanceof Variable && !e?.settingWatch) {
111
+ horizontalScrolling = this.tree.options.horizontalScrolling;
112
+ if (horizontalScrolling) {
113
+ this.tree.updateOptions({ horizontalScrolling: false });
114
+ }
115
+ this.tree.rerender(variable);
116
+ }
117
+ else if (!e && horizontalScrolling !== undefined) {
118
+ this.tree.updateOptions({ horizontalScrolling: horizontalScrolling });
119
+ horizontalScrolling = undefined;
120
+ }
121
+ }));
122
+ this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async (e) => {
123
+ if (e instanceof Variable && this.tree.hasNode(e)) {
124
+ await this.tree.updateChildren(e, false, true);
125
+ await this.tree.expand(e);
126
+ }
127
+ }));
128
+ this._register(this.debugService.onDidEndSession(() => {
129
+ this.savedViewState.clear();
130
+ this.autoExpandedScopes.clear();
131
+ }));
132
+ }
133
+ layoutBody(width, height) {
134
+ super.layoutBody(height, width);
135
+ this.tree.layout(width, height);
136
+ }
137
+ focus() {
138
+ this.tree.domFocus();
139
+ }
140
+ collapseAll() {
141
+ this.tree.collapseAll();
142
+ }
143
+ onMouseDblClick(e) {
144
+ const session = this.debugService.getViewModel().focusedSession;
145
+ if (session && e.element instanceof Variable && session.capabilities.supportsSetVariable && !e.element.presentationHint?.attributes?.includes('readOnly') && !e.element.presentationHint?.lazy) {
146
+ this.debugService.getViewModel().setSelectedExpression(e.element, false);
147
+ }
148
+ }
149
+ async onContextMenu(e) {
150
+ const variable = e.element;
151
+ if (!(variable instanceof Variable) || !variable.value) {
152
+ return;
153
+ }
154
+ const toDispose = ( new DisposableStore());
155
+ try {
156
+ const contextKeyService = await getContextForVariableMenuWithDataAccess(this.contextKeyService, variable);
157
+ const menu = toDispose.add(this.menuService.createMenu(MenuId.DebugVariablesContext, contextKeyService));
158
+ const context = getVariablesContext(variable);
159
+ const secondary = [];
160
+ createAndFillInContextMenuActions(menu, { arg: context, shouldForwardArgs: false }, { primary: [], secondary }, 'inline');
161
+ this.contextMenuService.showContextMenu({
162
+ getAnchor: () => e.anchor,
163
+ getActions: () => secondary
164
+ });
165
+ }
166
+ finally {
167
+ toDispose.dispose();
168
+ }
169
+ }
170
+ };
171
+ VariablesView = ( __decorate([
172
+ ( __param(1, IContextMenuService)),
173
+ ( __param(2, IDebugService)),
174
+ ( __param(3, IKeybindingService)),
175
+ ( __param(4, IConfigurationService)),
176
+ ( __param(5, IInstantiationService)),
177
+ ( __param(6, IViewDescriptorService)),
178
+ ( __param(7, IContextKeyService)),
179
+ ( __param(8, IOpenerService)),
180
+ ( __param(9, IThemeService)),
181
+ ( __param(10, ITelemetryService)),
182
+ ( __param(11, IMenuService))
183
+ ], VariablesView));
184
+ const getVariablesContext = (variable) => ({
185
+ sessionId: variable.getSession()?.getId(),
186
+ container: variable.parent instanceof Expression
187
+ ? { expression: variable.parent.name }
188
+ : variable.parent.toDebugProtocolObject(),
189
+ variable: variable.toDebugProtocolObject()
190
+ });
191
+ async function getContextForVariableMenuWithDataAccess(parentContext, variable) {
192
+ const session = variable.getSession();
193
+ if (!session || !session.capabilities.supportsDataBreakpoints) {
194
+ return getContextForVariableMenu(parentContext, variable);
195
+ }
196
+ const contextKeys = [];
197
+ dataBreakpointInfoResponse = await session.dataBreakpointInfo(variable.name, variable.parent.reference);
198
+ const dataBreakpointId = dataBreakpointInfoResponse?.dataId;
199
+ const dataBreakpointAccessTypes = dataBreakpointInfoResponse?.accessTypes;
200
+ if (!dataBreakpointAccessTypes) {
201
+ contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED.key, !!dataBreakpointId]);
202
+ }
203
+ else {
204
+ for (const accessType of dataBreakpointAccessTypes) {
205
+ switch (accessType) {
206
+ case 'read':
207
+ contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED.key, !!dataBreakpointId]);
208
+ break;
209
+ case 'write':
210
+ contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED.key, !!dataBreakpointId]);
211
+ break;
212
+ case 'readWrite':
213
+ contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED.key, !!dataBreakpointId]);
214
+ break;
215
+ }
216
+ }
217
+ }
218
+ return getContextForVariableMenu(parentContext, variable, contextKeys);
219
+ }
220
+ function getContextForVariableMenu(parentContext, variable, additionalContext = []) {
221
+ const session = variable.getSession();
222
+ const contextKeys = [
223
+ [CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT.key, variable.variableMenuContext || ''],
224
+ [CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT.key, !!variable.evaluateName],
225
+ [CONTEXT_CAN_VIEW_MEMORY.key, !!session?.capabilities.supportsReadMemoryRequest && variable.memoryReference !== undefined],
226
+ [CONTEXT_VARIABLE_IS_READONLY.key, !!variable.presentationHint?.attributes?.includes('readOnly') || variable.presentationHint?.lazy],
227
+ ...additionalContext,
228
+ ];
229
+ variableInternalContext = variable;
230
+ return parentContext.createOverlay(contextKeys);
231
+ }
232
+ function isStackFrame(obj) {
233
+ return obj instanceof StackFrame;
234
+ }
235
+ class VariablesDataSource {
236
+ hasChildren(element) {
237
+ if (!element) {
238
+ return false;
239
+ }
240
+ if (isStackFrame(element)) {
241
+ return true;
242
+ }
243
+ return element.hasChildren;
244
+ }
245
+ getChildren(element) {
246
+ if (isStackFrame(element)) {
247
+ return element.getScopes();
248
+ }
249
+ return element.getChildren();
250
+ }
251
+ }
252
+ class VariablesDelegate {
253
+ getHeight(element) {
254
+ return 22;
255
+ }
256
+ getTemplateId(element) {
257
+ if (element instanceof ErrorScope) {
258
+ return ScopeErrorRenderer.ID;
259
+ }
260
+ if (element instanceof Scope) {
261
+ return ScopesRenderer.ID;
262
+ }
263
+ return VariablesRenderer.ID;
264
+ }
265
+ }
266
+ class ScopesRenderer {
267
+ static { this.ID = 'scope'; }
268
+ get templateId() {
269
+ return ScopesRenderer.ID;
270
+ }
271
+ renderTemplate(container) {
272
+ const name = dom.append(container, $('.scope'));
273
+ const label = ( new HighlightedLabel(name));
274
+ return { name, label };
275
+ }
276
+ renderElement(element, index, templateData) {
277
+ templateData.label.set(element.element.name, createMatches(element.filterData));
278
+ }
279
+ disposeTemplate(templateData) {
280
+ }
281
+ }
282
+ class ScopeErrorRenderer {
283
+ static { this.ID = 'scopeError'; }
284
+ get templateId() {
285
+ return ScopeErrorRenderer.ID;
286
+ }
287
+ renderTemplate(container) {
288
+ const wrapper = dom.append(container, $('.scope'));
289
+ const error = dom.append(wrapper, $('.error'));
290
+ return { error };
291
+ }
292
+ renderElement(element, index, templateData) {
293
+ templateData.error.innerText = element.element.name;
294
+ }
295
+ disposeTemplate() {
296
+ }
297
+ }
298
+ let VariablesRenderer = class VariablesRenderer extends AbstractExpressionsRenderer {
299
+ static { VariablesRenderer_1 = this; }
300
+ static { this.ID = 'variable'; }
301
+ constructor(linkDetector, menuService, contextKeyService, debugService, contextViewService) {
302
+ super(debugService, contextViewService);
303
+ this.linkDetector = linkDetector;
304
+ this.menuService = menuService;
305
+ this.contextKeyService = contextKeyService;
306
+ }
307
+ get templateId() {
308
+ return VariablesRenderer_1.ID;
309
+ }
310
+ renderExpression(expression, data, highlights) {
311
+ renderVariable(expression, data, true, highlights, this.linkDetector);
312
+ }
313
+ renderElement(node, index, data) {
314
+ super.renderExpressionElement(node.element, node, data);
315
+ }
316
+ getInputBoxOptions(expression) {
317
+ const variable = expression;
318
+ return {
319
+ initialValue: expression.value,
320
+ ariaLabel: ( localize('variableValueAriaLabel', "Type new variable value")),
321
+ validationOptions: {
322
+ validation: () => variable.errorMessage ? ({ content: variable.errorMessage }) : null
323
+ },
324
+ onFinish: (value, success) => {
325
+ variable.errorMessage = undefined;
326
+ const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
327
+ if (success && variable.value !== value && focusedStackFrame) {
328
+ variable.setVariable(value, focusedStackFrame)
329
+ .then(() => {
330
+ forgetScopes = false;
331
+ this.debugService.getViewModel().updateViews();
332
+ });
333
+ }
334
+ }
335
+ };
336
+ }
337
+ renderActionBar(actionBar, expression) {
338
+ const variable = expression;
339
+ const contextKeyService = getContextForVariableMenu(this.contextKeyService, variable);
340
+ const menu = this.menuService.createMenu(MenuId.DebugVariablesContext, contextKeyService);
341
+ const primary = [];
342
+ const context = getVariablesContext(variable);
343
+ createAndFillInContextMenuActions(menu, { arg: context, shouldForwardArgs: false }, { primary, secondary: [] }, 'inline');
344
+ actionBar.clear();
345
+ actionBar.context = context;
346
+ actionBar.push(primary, { icon: true, label: false });
347
+ }
348
+ };
349
+ VariablesRenderer = VariablesRenderer_1 = ( __decorate([
350
+ ( __param(1, IMenuService)),
351
+ ( __param(2, IContextKeyService)),
352
+ ( __param(3, IDebugService)),
353
+ ( __param(4, IContextViewService))
354
+ ], VariablesRenderer));
355
+ class VariablesAccessibilityProvider {
356
+ getWidgetAriaLabel() {
357
+ return ( localize('variablesAriaTreeLabel', "Debug Variables"));
358
+ }
359
+ getAriaLabel(element) {
360
+ if (element instanceof Scope) {
361
+ return ( localize('variableScopeAriaLabel', "Scope {0}", element.name));
362
+ }
363
+ if (element instanceof Variable) {
364
+ return ( localize(
365
+ { key: 'variableAriaLabel', comment: ['Placeholders are variable name and variable value respectivly. They should not be translated.'] },
366
+ "{0}, value {1}",
367
+ element.name,
368
+ element.value
369
+ ));
370
+ }
371
+ return null;
372
+ }
373
+ }
374
+ const SET_VARIABLE_ID = 'debug.setVariable';
375
+ CommandsRegistry.registerCommand({
376
+ id: SET_VARIABLE_ID,
377
+ handler: (accessor) => {
378
+ const debugService = accessor.get(IDebugService);
379
+ debugService.getViewModel().setSelectedExpression(variableInternalContext, false);
380
+ }
381
+ });
382
+ const COPY_VALUE_ID = 'workbench.debug.viewlet.action.copyValue';
383
+ CommandsRegistry.registerCommand({
384
+ id: COPY_VALUE_ID,
385
+ handler: async (accessor, arg, ctx) => {
386
+ const debugService = accessor.get(IDebugService);
387
+ const clipboardService = accessor.get(IClipboardService);
388
+ let elementContext = '';
389
+ let elements;
390
+ if (arg instanceof Variable || arg instanceof Expression) {
391
+ elementContext = 'watch';
392
+ elements = ctx ? ctx : [];
393
+ }
394
+ else {
395
+ elementContext = 'variables';
396
+ elements = variableInternalContext ? [variableInternalContext] : [];
397
+ }
398
+ const stackFrame = debugService.getViewModel().focusedStackFrame;
399
+ const session = debugService.getViewModel().focusedSession;
400
+ if (!stackFrame || !session || elements.length === 0) {
401
+ return;
402
+ }
403
+ const evalContext = session.capabilities.supportsClipboardContext ? 'clipboard' : elementContext;
404
+ const toEvaluate = ( elements.map(
405
+ element => element instanceof Variable ? (element.evaluateName || element.value) : element.name
406
+ ));
407
+ try {
408
+ const evaluations = await Promise.all(( toEvaluate.map(expr => session.evaluate(expr, stackFrame.frameId, evalContext))));
409
+ const result = ( coalesce(evaluations).map(evaluation => evaluation.body.result));
410
+ if (result.length) {
411
+ clipboardService.writeText(result.join('\n'));
412
+ }
413
+ }
414
+ catch (e) {
415
+ const result = ( elements.map(element => element.value));
416
+ clipboardService.writeText(result.join('\n'));
417
+ }
418
+ }
419
+ });
420
+ const VIEW_MEMORY_ID = 'workbench.debug.viewlet.action.viewMemory';
421
+ const HEX_EDITOR_EXTENSION_ID = 'ms-vscode.hexeditor';
422
+ const HEX_EDITOR_EDITOR_ID = 'hexEditor.hexedit';
423
+ CommandsRegistry.registerCommand({
424
+ id: VIEW_MEMORY_ID,
425
+ handler: async (accessor, arg, ctx) => {
426
+ const debugService = accessor.get(IDebugService);
427
+ let sessionId;
428
+ let memoryReference;
429
+ if ('sessionId' in arg) {
430
+ if (!arg.sessionId || !arg.variable.memoryReference) {
431
+ return;
432
+ }
433
+ sessionId = arg.sessionId;
434
+ memoryReference = arg.variable.memoryReference;
435
+ }
436
+ else {
437
+ if (!arg.memoryReference) {
438
+ return;
439
+ }
440
+ const focused = debugService.getViewModel().focusedSession;
441
+ if (!focused) {
442
+ return;
443
+ }
444
+ sessionId = focused.getId();
445
+ memoryReference = arg.memoryReference;
446
+ }
447
+ const commandService = accessor.get(ICommandService);
448
+ const editorService = accessor.get(IEditorService);
449
+ const notifications = accessor.get(INotificationService);
450
+ const progressService = accessor.get(IProgressService);
451
+ const extensionService = accessor.get(IExtensionService);
452
+ const telemetryService = accessor.get(ITelemetryService);
453
+ const ext = await extensionService.getExtension(HEX_EDITOR_EXTENSION_ID);
454
+ if (ext || (await tryInstallHexEditor(notifications, progressService, extensionService, commandService))) {
455
+ telemetryService.publicLog('debug/didViewMemory', {
456
+ debugType: debugService.getModel().getSession(sessionId)?.configuration.type,
457
+ });
458
+ await editorService.openEditor({
459
+ resource: getUriForDebugMemory(sessionId, memoryReference),
460
+ options: {
461
+ revealIfOpened: true,
462
+ override: HEX_EDITOR_EDITOR_ID,
463
+ },
464
+ }, SIDE_GROUP);
465
+ }
466
+ }
467
+ });
468
+ function tryInstallHexEditor(notifications, progressService, extensionService, commandService) {
469
+ return ( new Promise(resolve => {
470
+ let installing = false;
471
+ const handle = notifications.prompt(Severity.Info, ( localize(
472
+ "viewMemory.prompt",
473
+ "Inspecting binary data requires the Hex Editor extension. Would you like to install it now?"
474
+ )), [
475
+ {
476
+ label: ( localize("cancel", "Cancel")),
477
+ run: () => resolve(false),
478
+ },
479
+ {
480
+ label: ( localize("install", "Install")),
481
+ run: async () => {
482
+ installing = true;
483
+ try {
484
+ await progressService.withProgress({
485
+ location: 15 ,
486
+ title: ( localize("viewMemory.install.progress", "Installing the Hex Editor...")),
487
+ }, async () => {
488
+ await commandService.executeCommand('workbench.extensions.installExtension', HEX_EDITOR_EXTENSION_ID);
489
+ while (!(await extensionService.getExtension(HEX_EDITOR_EXTENSION_ID))) {
490
+ await timeout(30);
491
+ }
492
+ });
493
+ resolve(true);
494
+ }
495
+ catch (e) {
496
+ notifications.error(e);
497
+ resolve(false);
498
+ }
499
+ }
500
+ },
501
+ ], { sticky: true });
502
+ handle.onDidClose(e => {
503
+ if (!installing) {
504
+ resolve(false);
505
+ }
506
+ });
507
+ }));
508
+ }
509
+ const BREAK_WHEN_VALUE_CHANGES_ID = 'debug.breakWhenValueChanges';
510
+ CommandsRegistry.registerCommand({
511
+ id: BREAK_WHEN_VALUE_CHANGES_ID,
512
+ handler: async (accessor) => {
513
+ const debugService = accessor.get(IDebugService);
514
+ if (dataBreakpointInfoResponse) {
515
+ await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'write');
516
+ }
517
+ }
518
+ });
519
+ const BREAK_WHEN_VALUE_IS_ACCESSED_ID = 'debug.breakWhenValueIsAccessed';
520
+ CommandsRegistry.registerCommand({
521
+ id: BREAK_WHEN_VALUE_IS_ACCESSED_ID,
522
+ handler: async (accessor) => {
523
+ const debugService = accessor.get(IDebugService);
524
+ if (dataBreakpointInfoResponse) {
525
+ await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'readWrite');
526
+ }
527
+ }
528
+ });
529
+ const BREAK_WHEN_VALUE_IS_READ_ID = 'debug.breakWhenValueIsRead';
530
+ CommandsRegistry.registerCommand({
531
+ id: BREAK_WHEN_VALUE_IS_READ_ID,
532
+ handler: async (accessor) => {
533
+ const debugService = accessor.get(IDebugService);
534
+ if (dataBreakpointInfoResponse) {
535
+ await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'read');
536
+ }
537
+ }
538
+ });
539
+ const COPY_EVALUATE_PATH_ID = 'debug.copyEvaluatePath';
540
+ CommandsRegistry.registerCommand({
541
+ id: COPY_EVALUATE_PATH_ID,
542
+ handler: async (accessor, context) => {
543
+ const clipboardService = accessor.get(IClipboardService);
544
+ await clipboardService.writeText(context.variable.evaluateName);
545
+ }
546
+ });
547
+ const ADD_TO_WATCH_ID = 'debug.addToWatchExpressions';
548
+ CommandsRegistry.registerCommand({
549
+ id: ADD_TO_WATCH_ID,
550
+ handler: async (accessor, context) => {
551
+ const debugService = accessor.get(IDebugService);
552
+ debugService.addWatchExpression(context.variable.evaluateName);
553
+ }
554
+ });
555
+ registerAction2(class extends ViewAction {
556
+ constructor() {
557
+ super({
558
+ id: 'variables.collapse',
559
+ viewId: VARIABLES_VIEW_ID,
560
+ title: ( localize('collapse', "Collapse All")),
561
+ f1: false,
562
+ icon: Codicon.collapseAll,
563
+ menu: {
564
+ id: MenuId.ViewTitle,
565
+ group: 'navigation',
566
+ when: ( ContextKeyExpr.equals('view', VARIABLES_VIEW_ID))
567
+ }
568
+ });
569
+ }
570
+ runInView(_accessor, view) {
571
+ view.collapseAll();
572
+ }
573
+ });
574
+
575
+ export { ADD_TO_WATCH_ID, BREAK_WHEN_VALUE_CHANGES_ID, BREAK_WHEN_VALUE_IS_ACCESSED_ID, BREAK_WHEN_VALUE_IS_READ_ID, COPY_EVALUATE_PATH_ID, COPY_VALUE_ID, SET_VARIABLE_ID, VIEW_MEMORY_ID, VariablesRenderer, VariablesView };