@codingame/monaco-vscode-debug-service-override 3.2.3 → 4.1.0

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/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +0 -73
  7. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +0 -1011
  8. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +0 -970
  9. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +0 -347
  10. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +0 -324
  11. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +0 -432
  12. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +0 -1039
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +0 -649
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +0 -64
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +0 -636
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -725
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -398
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +0 -206
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +0 -80
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +0 -169
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +0 -1271
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +0 -1305
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +0 -115
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +0 -77
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +0 -307
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +0 -31
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +0 -378
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +0 -267
  29. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +0 -808
  30. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -121
  31. package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +0 -141
  32. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +0 -262
  33. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +0 -669
  34. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +0 -6
  35. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +0 -6
  36. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +0 -6
  37. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +0 -6
  38. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
  39. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +0 -6
  40. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +0 -709
  41. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +0 -992
  42. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +0 -48
  43. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +0 -348
  44. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +0 -119
  45. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -763
  46. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +0 -501
  47. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +0 -162
  48. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +0 -21
  49. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +0 -17
  50. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +0 -110
  51. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +0 -62
  52. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +0 -460
  53. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +0 -162
  54. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +0 -36
  55. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +0 -148
  56. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +0 -289
  57. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +0 -87
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +0 -64
  59. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +0 -311
  60. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -28
@@ -1,763 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { append, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
3
- import { HighlightedLabel } from 'vscode/vscode/vs/base/browser/ui/highlightedlabel/highlightedLabel';
4
- import { Action } from 'vscode/vscode/vs/base/common/actions';
5
- import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
6
- import { timeout, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
7
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
8
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
9
- import { createMatches } from 'vscode/vscode/vs/base/common/filters';
10
- import { toDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
11
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
12
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
13
- import { createAndFillInContextMenuActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
14
- import { MenuId, registerAction2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
15
- import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
16
- import { CommandsRegistry, ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
17
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
18
- import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
19
- import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
20
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
21
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
22
- import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
23
- import { INotificationService, Severity } from 'vscode/vscode/vs/platform/notification/common/notification';
24
- import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
25
- import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress';
26
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
27
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
28
- import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
29
- import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
30
- import { AbstractExpressionsRenderer, renderExpressionValue, renderVariable, renderViewTree, AbstractExpressionDataSource } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
31
- import { LinkDetector } from './linkDetector.js';
32
- 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 } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
33
- import { getContextForVariable } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugContext';
34
- import { VisualizedExpression, Variable, getUriForDebugMemory, Expression, ErrorScope, Scope, StackFrame } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
35
- import { IDebugVisualizerService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugVisualizers';
36
- import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
37
- import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
38
-
39
- var VisualizedVariableRenderer_1, VariablesRenderer_1;
40
- const $ = $$1;
41
- let forgetScopes = true;
42
- let variableInternalContext;
43
- let dataBreakpointInfoResponse;
44
- let VariablesView = class VariablesView extends ViewPane {
45
- constructor(options, contextMenuService, debugService, keybindingService, configurationService, instantiationService, viewDescriptorService, contextKeyService, openerService, themeService, telemetryService, menuService) {
46
- super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
47
- this.debugService = debugService;
48
- this.menuService = menuService;
49
- this.needsRefresh = false;
50
- this.savedViewState = ( new Map());
51
- this.autoExpandedScopes = ( new Set());
52
- this.updateTreeScheduler = ( new RunOnceScheduler(async () => {
53
- const stackFrame = this.debugService.getViewModel().focusedStackFrame;
54
- this.needsRefresh = false;
55
- const input = this.tree.getInput();
56
- if (input) {
57
- this.savedViewState.set(input.getId(), this.tree.getViewState());
58
- }
59
- if (!stackFrame) {
60
- await this.tree.setInput(null);
61
- return;
62
- }
63
- const viewState = this.savedViewState.get(stackFrame.getId());
64
- await this.tree.setInput(stackFrame, viewState);
65
- const scopes = await stackFrame.getScopes();
66
- const toExpand = scopes.find(s => !s.expensive);
67
- if (toExpand && this.tree.hasNode(toExpand)) {
68
- this.autoExpandedScopes.add(toExpand.getId());
69
- await this.tree.expand(toExpand);
70
- }
71
- }, 400));
72
- }
73
- renderBody(container) {
74
- super.renderBody(container);
75
- this.element.classList.add('debug-pane');
76
- container.classList.add('debug-variables');
77
- const treeContainer = renderViewTree(container);
78
- const linkDetector = this.instantiationService.createInstance(LinkDetector);
79
- this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'VariablesView', treeContainer, ( new VariablesDelegate()), [
80
- this.instantiationService.createInstance(VariablesRenderer, linkDetector),
81
- this.instantiationService.createInstance(VisualizedVariableRenderer, linkDetector),
82
- ( new ScopesRenderer()),
83
- ( new ScopeErrorRenderer()),
84
- ], this.instantiationService.createInstance(VariablesDataSource), {
85
- accessibilityProvider: ( new VariablesAccessibilityProvider()),
86
- identityProvider: { getId: (element) => element.getId() },
87
- keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e) => e.name },
88
- overrideStyles: {
89
- listBackground: this.getBackgroundColor()
90
- }
91
- });
92
- this._register(VisualizedVariableRenderer.rendererOnVisualizationRange(this.debugService.getViewModel(), this.tree));
93
- this.tree.setInput(this.debugService.getViewModel().focusedStackFrame ?? null);
94
- CONTEXT_VARIABLES_FOCUSED.bindTo(this.tree.contextKeyService);
95
- this._register(this.debugService.getViewModel().onDidFocusStackFrame(sf => {
96
- if (!this.isBodyVisible()) {
97
- this.needsRefresh = true;
98
- return;
99
- }
100
- const timeout = sf.explicit ? 0 : undefined;
101
- this.updateTreeScheduler.schedule(timeout);
102
- }));
103
- this._register(this.debugService.getViewModel().onWillUpdateViews(() => {
104
- const stackFrame = this.debugService.getViewModel().focusedStackFrame;
105
- if (stackFrame && forgetScopes) {
106
- stackFrame.forgetScopes();
107
- }
108
- forgetScopes = true;
109
- this.tree.updateChildren();
110
- }));
111
- this._register(this.tree);
112
- this._register(this.tree.onMouseDblClick(e => this.onMouseDblClick(e)));
113
- this._register(this.tree.onContextMenu(async (e) => await this.onContextMenu(e)));
114
- this._register(this.onDidChangeBodyVisibility(visible => {
115
- if (visible && this.needsRefresh) {
116
- this.updateTreeScheduler.schedule();
117
- }
118
- }));
119
- let horizontalScrolling;
120
- this._register(this.debugService.getViewModel().onDidSelectExpression(e => {
121
- const variable = e?.expression;
122
- if (variable && this.tree.hasNode(variable)) {
123
- horizontalScrolling = this.tree.options.horizontalScrolling;
124
- if (horizontalScrolling) {
125
- this.tree.updateOptions({ horizontalScrolling: false });
126
- }
127
- this.tree.rerender(variable);
128
- }
129
- else if (!e && horizontalScrolling !== undefined) {
130
- this.tree.updateOptions({ horizontalScrolling: horizontalScrolling });
131
- horizontalScrolling = undefined;
132
- }
133
- }));
134
- this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async (e) => {
135
- if (e instanceof Variable && this.tree.hasNode(e)) {
136
- await this.tree.updateChildren(e, false, true);
137
- await this.tree.expand(e);
138
- }
139
- }));
140
- this._register(this.debugService.onDidEndSession(() => {
141
- this.savedViewState.clear();
142
- this.autoExpandedScopes.clear();
143
- }));
144
- }
145
- layoutBody(width, height) {
146
- super.layoutBody(height, width);
147
- this.tree.layout(width, height);
148
- }
149
- focus() {
150
- super.focus();
151
- this.tree.domFocus();
152
- }
153
- collapseAll() {
154
- this.tree.collapseAll();
155
- }
156
- onMouseDblClick(e) {
157
- if (this.canSetExpressionValue(e.element)) {
158
- this.debugService.getViewModel().setSelectedExpression(e.element, false);
159
- }
160
- }
161
- canSetExpressionValue(e) {
162
- const session = this.debugService.getViewModel().focusedSession;
163
- if (!session) {
164
- return false;
165
- }
166
- if (e instanceof VisualizedExpression) {
167
- return !!e.treeItem.canEdit;
168
- }
169
- return e instanceof Variable && !e.presentationHint?.attributes?.includes('readOnly') && !e.presentationHint?.lazy;
170
- }
171
- async onContextMenu(e) {
172
- const variable = e.element;
173
- if (!(variable instanceof Variable) || !variable.value) {
174
- return;
175
- }
176
- return openContextMenuForVariableTreeElement(this.contextKeyService, this.menuService, this.contextMenuService, MenuId.DebugVariablesContext, e);
177
- }
178
- };
179
- VariablesView = ( __decorate([
180
- ( __param(1, IContextMenuService)),
181
- ( __param(2, IDebugService)),
182
- ( __param(3, IKeybindingService)),
183
- ( __param(4, IConfigurationService)),
184
- ( __param(5, IInstantiationService)),
185
- ( __param(6, IViewDescriptorService)),
186
- ( __param(7, IContextKeyService)),
187
- ( __param(8, IOpenerService)),
188
- ( __param(9, IThemeService)),
189
- ( __param(10, ITelemetryService)),
190
- ( __param(11, IMenuService))
191
- ], VariablesView));
192
- async function openContextMenuForVariableTreeElement(parentContextKeyService, menuService, contextMenuService, menuId, e) {
193
- const variable = e.element;
194
- if (!(variable instanceof Variable) || !variable.value) {
195
- return;
196
- }
197
- const toDispose = ( new DisposableStore());
198
- try {
199
- const contextKeyService = await getContextForVariableMenuWithDataAccess(parentContextKeyService, variable);
200
- const menu = toDispose.add(menuService.createMenu(menuId, contextKeyService));
201
- const context = getVariablesContext(variable);
202
- const secondary = [];
203
- createAndFillInContextMenuActions(menu, { arg: context, shouldForwardArgs: false }, { primary: [], secondary }, 'inline');
204
- contextMenuService.showContextMenu({
205
- getAnchor: () => e.anchor,
206
- getActions: () => secondary
207
- });
208
- }
209
- finally {
210
- toDispose.dispose();
211
- }
212
- }
213
- const getVariablesContext = (variable) => ({
214
- sessionId: variable.getSession()?.getId(),
215
- container: variable.parent instanceof Expression
216
- ? { expression: variable.parent.name }
217
- : variable.parent.toDebugProtocolObject(),
218
- variable: variable.toDebugProtocolObject()
219
- });
220
- async function getContextForVariableMenuWithDataAccess(parentContext, variable) {
221
- const session = variable.getSession();
222
- if (!session || !session.capabilities.supportsDataBreakpoints) {
223
- return getContextForVariableMenuBase(parentContext, variable);
224
- }
225
- const contextKeys = [];
226
- dataBreakpointInfoResponse = await session.dataBreakpointInfo(variable.name, variable.parent.reference);
227
- const dataBreakpointId = dataBreakpointInfoResponse?.dataId;
228
- const dataBreakpointAccessTypes = dataBreakpointInfoResponse?.accessTypes;
229
- if (!dataBreakpointAccessTypes) {
230
- contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED.key, !!dataBreakpointId]);
231
- }
232
- else {
233
- for (const accessType of dataBreakpointAccessTypes) {
234
- switch (accessType) {
235
- case 'read':
236
- contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED.key, !!dataBreakpointId]);
237
- break;
238
- case 'write':
239
- contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED.key, !!dataBreakpointId]);
240
- break;
241
- case 'readWrite':
242
- contextKeys.push([CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED.key, !!dataBreakpointId]);
243
- break;
244
- }
245
- }
246
- }
247
- return getContextForVariableMenuBase(parentContext, variable, contextKeys);
248
- }
249
- function getContextForVariableMenuBase(parentContext, variable, additionalContext = []) {
250
- variableInternalContext = variable;
251
- return getContextForVariable(parentContext, variable, additionalContext);
252
- }
253
- function isStackFrame(obj) {
254
- return obj instanceof StackFrame;
255
- }
256
- class VariablesDataSource extends AbstractExpressionDataSource {
257
- hasChildren(element) {
258
- if (!element) {
259
- return false;
260
- }
261
- if (isStackFrame(element)) {
262
- return true;
263
- }
264
- return element.hasChildren;
265
- }
266
- doGetChildren(element) {
267
- if (isStackFrame(element)) {
268
- return element.getScopes();
269
- }
270
- return element.getChildren();
271
- }
272
- }
273
- class VariablesDelegate {
274
- getHeight(element) {
275
- return 22;
276
- }
277
- getTemplateId(element) {
278
- if (element instanceof ErrorScope) {
279
- return ScopeErrorRenderer.ID;
280
- }
281
- if (element instanceof Scope) {
282
- return ScopesRenderer.ID;
283
- }
284
- if (element instanceof VisualizedExpression) {
285
- return VisualizedVariableRenderer.ID;
286
- }
287
- return VariablesRenderer.ID;
288
- }
289
- }
290
- class ScopesRenderer {
291
- static { this.ID = 'scope'; }
292
- get templateId() {
293
- return ScopesRenderer.ID;
294
- }
295
- renderTemplate(container) {
296
- const name = append(container, $('.scope'));
297
- const label = ( new HighlightedLabel(name));
298
- return { name, label };
299
- }
300
- renderElement(element, index, templateData) {
301
- templateData.label.set(element.element.name, createMatches(element.filterData));
302
- }
303
- disposeTemplate(templateData) {
304
- }
305
- }
306
- class ScopeErrorRenderer {
307
- static { this.ID = 'scopeError'; }
308
- get templateId() {
309
- return ScopeErrorRenderer.ID;
310
- }
311
- renderTemplate(container) {
312
- const wrapper = append(container, $('.scope'));
313
- const error = append(wrapper, $('.error'));
314
- return { error };
315
- }
316
- renderElement(element, index, templateData) {
317
- templateData.error.innerText = element.element.name;
318
- }
319
- disposeTemplate() {
320
- }
321
- }
322
- let VisualizedVariableRenderer = class VisualizedVariableRenderer extends AbstractExpressionsRenderer {
323
- static { VisualizedVariableRenderer_1 = this; }
324
- static { this.ID = 'viz'; }
325
- static rendererOnVisualizationRange(model, tree) {
326
- return model.onDidChangeVisualization(({ original }) => {
327
- if (!tree.hasNode(original)) {
328
- return;
329
- }
330
- const parent = tree.getParentElement(original);
331
- tree.updateChildren(parent, false, false);
332
- });
333
- }
334
- constructor(linkDetector, debugService, contextViewService, menuService, contextKeyService) {
335
- super(debugService, contextViewService);
336
- this.linkDetector = linkDetector;
337
- this.menuService = menuService;
338
- this.contextKeyService = contextKeyService;
339
- }
340
- get templateId() {
341
- return VisualizedVariableRenderer_1.ID;
342
- }
343
- renderElement(node, index, data) {
344
- super.renderExpressionElement(node.element, node, data);
345
- }
346
- renderExpression(expression, data, highlights) {
347
- const viz = expression;
348
- let text = viz.name;
349
- if (viz.value && typeof viz.name === 'string') {
350
- text += ':';
351
- }
352
- data.label.set(text, highlights, viz.name);
353
- renderExpressionValue(viz, data.value, {
354
- showChanged: false,
355
- maxValueLength: 1024,
356
- showHover: true,
357
- colorize: true,
358
- linkDetector: this.linkDetector
359
- });
360
- }
361
- getInputBoxOptions(expression) {
362
- const viz = expression;
363
- return {
364
- initialValue: expression.value,
365
- ariaLabel: ( localizeWithPath(
366
- 'vs/workbench/contrib/debug/browser/variablesView',
367
- 'variableValueAriaLabel',
368
- "Type new variable value"
369
- )),
370
- validationOptions: {
371
- validation: () => viz.errorMessage ? ({ content: viz.errorMessage }) : null
372
- },
373
- onFinish: (value, success) => {
374
- viz.errorMessage = undefined;
375
- if (success) {
376
- viz.edit(value).then(() => {
377
- forgetScopes = false;
378
- this.debugService.getViewModel().updateViews();
379
- });
380
- }
381
- }
382
- };
383
- }
384
- renderActionBar(actionBar, expression, _data) {
385
- const viz = expression;
386
- const contextKeyService = viz.original ? getContextForVariableMenuBase(this.contextKeyService, viz.original) : this.contextKeyService;
387
- const menu = this.menuService.createMenu(MenuId.DebugVariablesContext, contextKeyService);
388
- const primary = [];
389
- const context = viz.original ? getVariablesContext(viz.original) : undefined;
390
- createAndFillInContextMenuActions(menu, { arg: context, shouldForwardArgs: false }, { primary, secondary: [] }, 'inline');
391
- if (viz.original) {
392
- const action = ( new Action('debugViz', ( localizeWithPath(
393
- 'vs/workbench/contrib/debug/browser/variablesView',
394
- 'removeVisualizer',
395
- 'Remove Visualizer'
396
- )), ThemeIcon.asClassName(Codicon.eye), true, () => this.debugService.getViewModel().setVisualizedExpression(viz.original, undefined)));
397
- action.checked = true;
398
- primary.push(action);
399
- actionBar.domNode.style.display = 'initial';
400
- }
401
- actionBar.clear();
402
- actionBar.context = context;
403
- actionBar.push(primary, { icon: true, label: false });
404
- }
405
- };
406
- VisualizedVariableRenderer = VisualizedVariableRenderer_1 = ( __decorate([
407
- ( __param(1, IDebugService)),
408
- ( __param(2, IContextViewService)),
409
- ( __param(3, IMenuService)),
410
- ( __param(4, IContextKeyService))
411
- ], VisualizedVariableRenderer));
412
- let VariablesRenderer = class VariablesRenderer extends AbstractExpressionsRenderer {
413
- static { VariablesRenderer_1 = this; }
414
- static { this.ID = 'variable'; }
415
- constructor(linkDetector, menuService, contextKeyService, visualization, contextMenuService, debugService, contextViewService) {
416
- super(debugService, contextViewService);
417
- this.linkDetector = linkDetector;
418
- this.menuService = menuService;
419
- this.contextKeyService = contextKeyService;
420
- this.visualization = visualization;
421
- this.contextMenuService = contextMenuService;
422
- }
423
- get templateId() {
424
- return VariablesRenderer_1.ID;
425
- }
426
- renderExpression(expression, data, highlights) {
427
- renderVariable(expression, data, true, highlights, this.linkDetector);
428
- }
429
- renderElement(node, index, data) {
430
- super.renderExpressionElement(node.element, node, data);
431
- }
432
- getInputBoxOptions(expression) {
433
- const variable = expression;
434
- return {
435
- initialValue: expression.value,
436
- ariaLabel: ( localizeWithPath(
437
- 'vs/workbench/contrib/debug/browser/variablesView',
438
- 'variableValueAriaLabel',
439
- "Type new variable value"
440
- )),
441
- validationOptions: {
442
- validation: () => variable.errorMessage ? ({ content: variable.errorMessage }) : null
443
- },
444
- onFinish: (value, success) => {
445
- variable.errorMessage = undefined;
446
- const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
447
- if (success && variable.value !== value && focusedStackFrame) {
448
- variable.setVariable(value, focusedStackFrame)
449
- .then(() => {
450
- forgetScopes = false;
451
- this.debugService.getViewModel().updateViews();
452
- });
453
- }
454
- }
455
- };
456
- }
457
- renderActionBar(actionBar, expression, data) {
458
- const variable = expression;
459
- const contextKeyService = getContextForVariableMenuBase(this.contextKeyService, variable);
460
- const menu = this.menuService.createMenu(MenuId.DebugVariablesContext, contextKeyService);
461
- const primary = [];
462
- const context = getVariablesContext(variable);
463
- createAndFillInContextMenuActions(menu, { arg: context, shouldForwardArgs: false }, { primary, secondary: [] }, 'inline');
464
- actionBar.clear();
465
- actionBar.context = context;
466
- actionBar.push(primary, { icon: true, label: false });
467
- const cts = ( new CancellationTokenSource());
468
- data.elementDisposable.add(toDisposable(() => cts.dispose(true)));
469
- this.visualization.getApplicableFor(expression, cts.token).then(result => {
470
- data.elementDisposable.add(result);
471
- const originalExpression = (expression instanceof VisualizedExpression && expression.original) || expression;
472
- const actions = ( result.object.map(v => ( new Action(
473
- 'debugViz',
474
- v.name,
475
- v.iconClass || 'debug-viz-icon',
476
- undefined,
477
- this.useVisualizer(v, originalExpression, cts.token)
478
- ))));
479
- if (actions.length === 0) ;
480
- else if (actions.length === 1) {
481
- actionBar.push(actions[0], { icon: true, label: false });
482
- }
483
- else {
484
- actionBar.push(( new Action('debugViz', ( localizeWithPath(
485
- 'vs/workbench/contrib/debug/browser/variablesView',
486
- 'useVisualizer',
487
- 'Visualize Variable...'
488
- )), ThemeIcon.asClassName(Codicon.eye), undefined, () => this.pickVisualizer(actions, originalExpression, data))), { icon: true, label: false });
489
- }
490
- });
491
- }
492
- pickVisualizer(actions, expression, data) {
493
- this.contextMenuService.showContextMenu({
494
- getAnchor: () => data.actionBar.getContainer(),
495
- getActions: () => actions,
496
- });
497
- }
498
- useVisualizer(viz, expression, token) {
499
- return async () => {
500
- const resolved = await viz.resolve(token);
501
- if (token.isCancellationRequested) {
502
- return;
503
- }
504
- if (resolved.type === 0 ) {
505
- viz.execute();
506
- }
507
- else {
508
- const replacement = await this.visualization.getVisualizedNodeFor(resolved.id, expression);
509
- if (replacement) {
510
- this.debugService.getViewModel().setVisualizedExpression(expression, replacement);
511
- }
512
- }
513
- };
514
- }
515
- };
516
- VariablesRenderer = VariablesRenderer_1 = ( __decorate([
517
- ( __param(1, IMenuService)),
518
- ( __param(2, IContextKeyService)),
519
- ( __param(3, IDebugVisualizerService)),
520
- ( __param(4, IContextMenuService)),
521
- ( __param(5, IDebugService)),
522
- ( __param(6, IContextViewService))
523
- ], VariablesRenderer));
524
- class VariablesAccessibilityProvider {
525
- getWidgetAriaLabel() {
526
- return ( localizeWithPath(
527
- 'vs/workbench/contrib/debug/browser/variablesView',
528
- 'variablesAriaTreeLabel',
529
- "Debug Variables"
530
- ));
531
- }
532
- getAriaLabel(element) {
533
- if (element instanceof Scope) {
534
- return ( localizeWithPath(
535
- 'vs/workbench/contrib/debug/browser/variablesView',
536
- 'variableScopeAriaLabel',
537
- "Scope {0}",
538
- element.name
539
- ));
540
- }
541
- if (element instanceof Variable) {
542
- return ( localizeWithPath(
543
- 'vs/workbench/contrib/debug/browser/variablesView',
544
- { key: 'variableAriaLabel', comment: ['Placeholders are variable name and variable value respectivly. They should not be translated.'] },
545
- "{0}, value {1}",
546
- element.name,
547
- element.value
548
- ));
549
- }
550
- return null;
551
- }
552
- }
553
- const SET_VARIABLE_ID = 'debug.setVariable';
554
- CommandsRegistry.registerCommand({
555
- id: SET_VARIABLE_ID,
556
- handler: (accessor) => {
557
- const debugService = accessor.get(IDebugService);
558
- debugService.getViewModel().setSelectedExpression(variableInternalContext, false);
559
- }
560
- });
561
- const COPY_VALUE_ID = 'workbench.debug.viewlet.action.copyValue';
562
- CommandsRegistry.registerCommand({
563
- id: COPY_VALUE_ID,
564
- handler: async (accessor, arg, ctx) => {
565
- const debugService = accessor.get(IDebugService);
566
- const clipboardService = accessor.get(IClipboardService);
567
- let elementContext = '';
568
- let elements;
569
- if (arg instanceof Variable || arg instanceof Expression) {
570
- elementContext = 'watch';
571
- elements = ctx ? ctx : [];
572
- }
573
- else {
574
- elementContext = 'variables';
575
- elements = variableInternalContext ? [variableInternalContext] : [];
576
- }
577
- const stackFrame = debugService.getViewModel().focusedStackFrame;
578
- const session = debugService.getViewModel().focusedSession;
579
- if (!stackFrame || !session || elements.length === 0) {
580
- return;
581
- }
582
- const evalContext = session.capabilities.supportsClipboardContext ? 'clipboard' : elementContext;
583
- const toEvaluate = ( elements.map(
584
- element => element instanceof Variable ? (element.evaluateName || element.value) : element.name
585
- ));
586
- try {
587
- const evaluations = await Promise.all(( toEvaluate.map(expr => session.evaluate(expr, stackFrame.frameId, evalContext))));
588
- const result = ( coalesce(evaluations).map(evaluation => evaluation.body.result));
589
- if (result.length) {
590
- clipboardService.writeText(result.join('\n'));
591
- }
592
- }
593
- catch (e) {
594
- const result = ( elements.map(element => element.value));
595
- clipboardService.writeText(result.join('\n'));
596
- }
597
- }
598
- });
599
- const VIEW_MEMORY_ID = 'workbench.debug.viewlet.action.viewMemory';
600
- const HEX_EDITOR_EXTENSION_ID = 'ms-vscode.hexeditor';
601
- const HEX_EDITOR_EDITOR_ID = 'hexEditor.hexedit';
602
- CommandsRegistry.registerCommand({
603
- id: VIEW_MEMORY_ID,
604
- handler: async (accessor, arg, ctx) => {
605
- const debugService = accessor.get(IDebugService);
606
- let sessionId;
607
- let memoryReference;
608
- if ('sessionId' in arg) {
609
- if (!arg.sessionId || !arg.variable.memoryReference) {
610
- return;
611
- }
612
- sessionId = arg.sessionId;
613
- memoryReference = arg.variable.memoryReference;
614
- }
615
- else {
616
- if (!arg.memoryReference) {
617
- return;
618
- }
619
- const focused = debugService.getViewModel().focusedSession;
620
- if (!focused) {
621
- return;
622
- }
623
- sessionId = focused.getId();
624
- memoryReference = arg.memoryReference;
625
- }
626
- const commandService = accessor.get(ICommandService);
627
- const editorService = accessor.get(IEditorService);
628
- const notifications = accessor.get(INotificationService);
629
- const progressService = accessor.get(IProgressService);
630
- const extensionService = accessor.get(IExtensionService);
631
- const telemetryService = accessor.get(ITelemetryService);
632
- const ext = await extensionService.getExtension(HEX_EDITOR_EXTENSION_ID);
633
- if (ext || (await tryInstallHexEditor(notifications, progressService, extensionService, commandService))) {
634
- telemetryService.publicLog('debug/didViewMemory', {
635
- debugType: debugService.getModel().getSession(sessionId)?.configuration.type,
636
- });
637
- await editorService.openEditor({
638
- resource: getUriForDebugMemory(sessionId, memoryReference),
639
- options: {
640
- revealIfOpened: true,
641
- override: HEX_EDITOR_EDITOR_ID,
642
- },
643
- }, SIDE_GROUP);
644
- }
645
- }
646
- });
647
- function tryInstallHexEditor(notifications, progressService, extensionService, commandService) {
648
- return ( new Promise(resolve => {
649
- let installing = false;
650
- const handle = notifications.prompt(Severity.Info, ( localizeWithPath(
651
- 'vs/workbench/contrib/debug/browser/variablesView',
652
- "viewMemory.prompt",
653
- "Inspecting binary data requires the Hex Editor extension. Would you like to install it now?"
654
- )), [
655
- {
656
- label: ( localizeWithPath('vs/workbench/contrib/debug/browser/variablesView', "cancel", "Cancel")),
657
- run: () => resolve(false),
658
- },
659
- {
660
- label: ( localizeWithPath('vs/workbench/contrib/debug/browser/variablesView', "install", "Install")),
661
- run: async () => {
662
- installing = true;
663
- try {
664
- await progressService.withProgress({
665
- location: 15 ,
666
- title: ( localizeWithPath(
667
- 'vs/workbench/contrib/debug/browser/variablesView',
668
- "viewMemory.install.progress",
669
- "Installing the Hex Editor..."
670
- )),
671
- }, async () => {
672
- await commandService.executeCommand('workbench.extensions.installExtension', HEX_EDITOR_EXTENSION_ID);
673
- while (!(await extensionService.getExtension(HEX_EDITOR_EXTENSION_ID))) {
674
- await timeout(30);
675
- }
676
- });
677
- resolve(true);
678
- }
679
- catch (e) {
680
- notifications.error(e);
681
- resolve(false);
682
- }
683
- }
684
- },
685
- ], { sticky: true });
686
- handle.onDidClose(e => {
687
- if (!installing) {
688
- resolve(false);
689
- }
690
- });
691
- }));
692
- }
693
- const BREAK_WHEN_VALUE_CHANGES_ID = 'debug.breakWhenValueChanges';
694
- CommandsRegistry.registerCommand({
695
- id: BREAK_WHEN_VALUE_CHANGES_ID,
696
- handler: async (accessor) => {
697
- const debugService = accessor.get(IDebugService);
698
- if (dataBreakpointInfoResponse) {
699
- await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'write', undefined);
700
- }
701
- }
702
- });
703
- const BREAK_WHEN_VALUE_IS_ACCESSED_ID = 'debug.breakWhenValueIsAccessed';
704
- CommandsRegistry.registerCommand({
705
- id: BREAK_WHEN_VALUE_IS_ACCESSED_ID,
706
- handler: async (accessor) => {
707
- const debugService = accessor.get(IDebugService);
708
- if (dataBreakpointInfoResponse) {
709
- await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'readWrite', undefined);
710
- }
711
- }
712
- });
713
- const BREAK_WHEN_VALUE_IS_READ_ID = 'debug.breakWhenValueIsRead';
714
- CommandsRegistry.registerCommand({
715
- id: BREAK_WHEN_VALUE_IS_READ_ID,
716
- handler: async (accessor) => {
717
- const debugService = accessor.get(IDebugService);
718
- if (dataBreakpointInfoResponse) {
719
- await debugService.addDataBreakpoint(dataBreakpointInfoResponse.description, dataBreakpointInfoResponse.dataId, !!dataBreakpointInfoResponse.canPersist, dataBreakpointInfoResponse.accessTypes, 'read', undefined);
720
- }
721
- }
722
- });
723
- const COPY_EVALUATE_PATH_ID = 'debug.copyEvaluatePath';
724
- CommandsRegistry.registerCommand({
725
- id: COPY_EVALUATE_PATH_ID,
726
- handler: async (accessor, context) => {
727
- const clipboardService = accessor.get(IClipboardService);
728
- await clipboardService.writeText(context.variable.evaluateName);
729
- }
730
- });
731
- const ADD_TO_WATCH_ID = 'debug.addToWatchExpressions';
732
- CommandsRegistry.registerCommand({
733
- id: ADD_TO_WATCH_ID,
734
- handler: async (accessor, context) => {
735
- const debugService = accessor.get(IDebugService);
736
- debugService.addWatchExpression(context.variable.evaluateName);
737
- }
738
- });
739
- registerAction2(class extends ViewAction {
740
- constructor() {
741
- super({
742
- id: 'variables.collapse',
743
- viewId: VARIABLES_VIEW_ID,
744
- title: ( localizeWithPath(
745
- 'vs/workbench/contrib/debug/browser/variablesView',
746
- 'collapse',
747
- "Collapse All"
748
- )),
749
- f1: false,
750
- icon: Codicon.collapseAll,
751
- menu: {
752
- id: MenuId.ViewTitle,
753
- group: 'navigation',
754
- when: ( ContextKeyExpr.equals('view', VARIABLES_VIEW_ID))
755
- }
756
- });
757
- }
758
- runInView(_accessor, view) {
759
- view.collapseAll();
760
- }
761
- });
762
-
763
- 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, VisualizedVariableRenderer, openContextMenuForVariableTreeElement };