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