@theia/memory-inspector 1.45.0 → 1.46.0-next.72

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 (102) hide show
  1. package/README.md +71 -71
  2. package/lib/browser/diff-widget/memory-diff-options-widget.d.ts +36 -36
  3. package/lib/browser/diff-widget/memory-diff-options-widget.js +132 -132
  4. package/lib/browser/diff-widget/memory-diff-select-widget.d.ts +50 -50
  5. package/lib/browser/diff-widget/memory-diff-select-widget.js +137 -137
  6. package/lib/browser/diff-widget/memory-diff-table-widget.d.ts +77 -77
  7. package/lib/browser/diff-widget/memory-diff-table-widget.js +314 -314
  8. package/lib/browser/diff-widget/memory-diff-widget-types.d.ts +41 -41
  9. package/lib/browser/diff-widget/memory-diff-widget-types.js +23 -23
  10. package/lib/browser/editable-widget/memory-editable-table-widget.d.ts +64 -64
  11. package/lib/browser/editable-widget/memory-editable-table-widget.js +324 -324
  12. package/lib/browser/memory-inspector-frontend-contribution.d.ts +46 -46
  13. package/lib/browser/memory-inspector-frontend-contribution.js +291 -291
  14. package/lib/browser/memory-inspector-frontend-module.d.ts +21 -21
  15. package/lib/browser/memory-inspector-frontend-module.js +87 -87
  16. package/lib/browser/memory-provider/cdt-gdb-memory-provider.d.ts +35 -35
  17. package/lib/browser/memory-provider/cdt-gdb-memory-provider.js +136 -136
  18. package/lib/browser/memory-provider/memory-provider-service.d.ts +36 -36
  19. package/lib/browser/memory-provider/memory-provider-service.js +101 -101
  20. package/lib/browser/memory-provider/memory-provider.d.ts +65 -65
  21. package/lib/browser/memory-provider/memory-provider.js +96 -96
  22. package/lib/browser/memory-provider/memory-provider.spec.d.ts +16 -16
  23. package/lib/browser/memory-provider/memory-provider.spec.js +23 -23
  24. package/lib/browser/memory-widget/memory-options-widget.d.ts +136 -136
  25. package/lib/browser/memory-widget/memory-options-widget.js +564 -564
  26. package/lib/browser/memory-widget/memory-table-widget.d.ts +146 -146
  27. package/lib/browser/memory-widget/memory-table-widget.js +487 -487
  28. package/lib/browser/memory-widget/memory-widget.d.ts +33 -33
  29. package/lib/browser/memory-widget/memory-widget.js +112 -112
  30. package/lib/browser/register-widget/register-filter-service.d.ts +42 -42
  31. package/lib/browser/register-widget/register-filter-service.js +81 -81
  32. package/lib/browser/register-widget/register-options-widget.d.ts +81 -81
  33. package/lib/browser/register-widget/register-options-widget.js +338 -338
  34. package/lib/browser/register-widget/register-table-widget.d.ts +77 -77
  35. package/lib/browser/register-widget/register-table-widget.js +230 -230
  36. package/lib/browser/register-widget/register-widget-types.d.ts +29 -29
  37. package/lib/browser/register-widget/register-widget-types.js +35 -35
  38. package/lib/browser/utils/memory-commands.d.ts +27 -27
  39. package/lib/browser/utils/memory-commands.js +67 -67
  40. package/lib/browser/utils/memory-hover-renderer.d.ts +33 -33
  41. package/lib/browser/utils/memory-hover-renderer.js +111 -111
  42. package/lib/browser/utils/memory-recents.d.ts +27 -27
  43. package/lib/browser/utils/memory-recents.js +52 -52
  44. package/lib/browser/utils/memory-widget-components.d.ts +58 -58
  45. package/lib/browser/utils/memory-widget-components.js +69 -69
  46. package/lib/browser/utils/memory-widget-manager.d.ts +50 -50
  47. package/lib/browser/utils/memory-widget-manager.js +182 -182
  48. package/lib/browser/utils/memory-widget-utils.d.ts +113 -113
  49. package/lib/browser/utils/memory-widget-utils.js +42 -42
  50. package/lib/browser/utils/memory-widget-variable-utils.d.ts +57 -57
  51. package/lib/browser/utils/memory-widget-variable-utils.js +143 -143
  52. package/lib/browser/utils/multi-select-bar.d.ts +31 -31
  53. package/lib/browser/utils/multi-select-bar.js +34 -34
  54. package/lib/browser/wrapper-widgets/memory-dock-panel.d.ts +24 -24
  55. package/lib/browser/wrapper-widgets/memory-dock-panel.js +48 -48
  56. package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.d.ts +23 -23
  57. package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.js +57 -57
  58. package/lib/browser/wrapper-widgets/memory-layout-widget.d.ts +51 -51
  59. package/lib/browser/wrapper-widgets/memory-layout-widget.js +191 -191
  60. package/lib/common/util.d.ts +21 -21
  61. package/lib/common/util.js +30 -30
  62. package/lib/common/utils.spec.d.ts +16 -16
  63. package/lib/common/utils.spec.js +45 -45
  64. package/package.json +4 -4
  65. package/src/browser/diff-widget/memory-diff-options-widget.tsx +152 -152
  66. package/src/browser/diff-widget/memory-diff-select-widget.tsx +163 -163
  67. package/src/browser/diff-widget/memory-diff-table-widget.tsx +366 -366
  68. package/src/browser/diff-widget/memory-diff-widget-types.ts +45 -45
  69. package/src/browser/editable-widget/memory-editable-table-widget.tsx +359 -359
  70. package/src/browser/memory-inspector-frontend-contribution.ts +301 -301
  71. package/src/browser/memory-inspector-frontend-module.ts +118 -118
  72. package/src/browser/memory-provider/cdt-gdb-memory-provider.ts +132 -132
  73. package/src/browser/memory-provider/memory-provider-service.ts +86 -86
  74. package/src/browser/memory-provider/memory-provider.spec.ts +23 -23
  75. package/src/browser/memory-provider/memory-provider.ts +119 -119
  76. package/src/browser/memory-widget/memory-options-widget.tsx +738 -738
  77. package/src/browser/memory-widget/memory-table-widget.tsx +625 -625
  78. package/src/browser/memory-widget/memory-widget.ts +114 -114
  79. package/src/browser/register-widget/register-filter-service.ts +76 -76
  80. package/src/browser/register-widget/register-options-widget.tsx +393 -393
  81. package/src/browser/register-widget/register-table-widget.tsx +276 -276
  82. package/src/browser/register-widget/register-widget-types.ts +45 -45
  83. package/src/browser/register-widget/register-widget.css +34 -34
  84. package/src/browser/style/index.css +746 -746
  85. package/src/browser/style/memory-lock.svg +21 -21
  86. package/src/browser/style/memory-view.svg +20 -20
  87. package/src/browser/style/register-lock.svg +29 -29
  88. package/src/browser/style/register-view.svg +28 -28
  89. package/src/browser/utils/memory-commands.ts +76 -76
  90. package/src/browser/utils/memory-hover-renderer.ts +113 -113
  91. package/src/browser/utils/memory-recents.ts +58 -58
  92. package/src/browser/utils/memory-widget-components.tsx +193 -193
  93. package/src/browser/utils/memory-widget-manager.ts +179 -179
  94. package/src/browser/utils/memory-widget-utils.tsx +132 -132
  95. package/src/browser/utils/memory-widget-variable-utils.ts +170 -170
  96. package/src/browser/utils/multi-select-bar.css +61 -61
  97. package/src/browser/utils/multi-select-bar.tsx +75 -75
  98. package/src/browser/wrapper-widgets/memory-dock-panel.ts +51 -51
  99. package/src/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.tsx +38 -38
  100. package/src/browser/wrapper-widgets/memory-layout-widget.tsx +167 -167
  101. package/src/common/util.ts +28 -28
  102. package/src/common/utils.spec.ts +52 -52
@@ -1,292 +1,292 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (C) 2019 Ericsson and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.DebugFrontendContribution = void 0;
28
- const browser_1 = require("@theia/core/lib/browser");
29
- const frontend_application_state_1 = require("@theia/core/lib/browser/frontend-application-state");
30
- const color_1 = require("@theia/core/lib/common/color");
31
- const inversify_1 = require("@theia/core/shared/inversify");
32
- const debug_console_items_1 = require("@theia/debug/lib/browser/console/debug-console-items");
33
- const debug_frontend_application_contribution_1 = require("@theia/debug/lib/browser/debug-frontend-application-contribution");
34
- const debug_variables_widget_1 = require("@theia/debug/lib/browser/view/debug-variables-widget");
35
- const Long = require("long");
36
- const memory_editable_table_widget_1 = require("./editable-widget/memory-editable-table-widget");
37
- const memory_provider_service_1 = require("./memory-provider/memory-provider-service");
38
- const memory_table_widget_1 = require("./memory-widget/memory-table-widget");
39
- const register_table_widget_1 = require("./register-widget/register-table-widget");
40
- const memory_commands_1 = require("./utils/memory-commands");
41
- const memory_widget_manager_1 = require("./utils/memory-widget-manager");
42
- const memory_dock_panel_1 = require("./wrapper-widgets/memory-dock-panel");
43
- const memory_layout_widget_1 = require("./wrapper-widgets/memory-layout-widget");
44
- const nls_1 = require("@theia/core/lib/common/nls");
45
- const ONE_HALF_OPACITY = 0.5;
46
- let DebugFrontendContribution = class DebugFrontendContribution extends browser_1.AbstractViewContribution {
47
- constructor() {
48
- super({
49
- widgetId: memory_layout_widget_1.MemoryLayoutWidget.ID,
50
- widgetName: memory_layout_widget_1.MemoryLayoutWidget.LABEL,
51
- defaultWidgetOptions: {
52
- area: 'right',
53
- },
54
- toggleCommandId: memory_commands_1.MemoryCommand.id,
55
- });
56
- }
57
- init() {
58
- this.stateService.reachedState('initialized_layout').then(() => {
59
- // Close leftover widgets from previous sessions.
60
- this.memoryWidgetManager.availableWidgets.forEach(widget => {
61
- if (!(widget.parent instanceof memory_dock_panel_1.MemoryDockPanel)) {
62
- widget.close();
63
- }
64
- });
65
- });
66
- }
67
- async initializeLayout() {
68
- await this.openView({ activate: false });
69
- }
70
- registerCommands(registry) {
71
- super.registerCommands(registry);
72
- registry.registerCommand(memory_commands_1.ViewVariableInMemoryCommand, {
73
- execute: async () => {
74
- const { selectedVariable } = this.debugContribution;
75
- const referenceText = this.memoryProvider.formatVariableReference(selectedVariable);
76
- if (referenceText) {
77
- await this.openMemoryWidgetAt(referenceText);
78
- }
79
- },
80
- isVisible: () => {
81
- const { selectedVariable } = this.debugContribution;
82
- return Boolean(this.memoryProvider.supportsVariableReferenceSyntax(selectedVariable) && this.memoryProvider.formatVariableReference(selectedVariable));
83
- },
84
- });
85
- registry.registerCommand(memory_commands_1.ViewVariableInRegisterViewCommand, {
86
- execute: async () => {
87
- var _a;
88
- const name = (_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.name;
89
- if (name) {
90
- await this.openRegisterWidgetWithReg(name);
91
- }
92
- },
93
- isVisible: () => {
94
- var _a, _b;
95
- let { selectedVariable: currentLevel } = this.debugContribution;
96
- if (!currentLevel) {
97
- return false;
98
- }
99
- // Make sure it looks like it has a numerical value.
100
- try {
101
- BigInt(currentLevel.value);
102
- }
103
- catch {
104
- return false;
105
- }
106
- while (currentLevel.parent instanceof debug_console_items_1.DebugVariable) {
107
- currentLevel = currentLevel.parent;
108
- }
109
- return currentLevel.parent instanceof debug_console_items_1.DebugScope && ((_b = (_a = currentLevel.parent) === null || _a === void 0 ? void 0 : _a['raw']) === null || _b === void 0 ? void 0 : _b.name) === 'Registers';
110
- },
111
- });
112
- registry.registerCommand(memory_commands_1.FollowPointerDebugCommand, {
113
- isVisible: () => { var _a; return !!this.isPointer((_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.type); },
114
- isEnabled: () => { var _a; return !!this.isPointer((_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.type); },
115
- execute: async () => {
116
- var _a;
117
- const name = (_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.name;
118
- if (name) {
119
- await this.openMemoryWidgetAt(name);
120
- }
121
- },
122
- });
123
- registry.registerCommand(memory_commands_1.ResetModifiedCellCommand, {
124
- isEnabled: (widgetToActOn, address) => Long.isLong(address) && widgetToActOn instanceof memory_editable_table_widget_1.MemoryEditableTableWidget,
125
- isVisible: (widgetToActOn, address) => Long.isLong(address) && widgetToActOn instanceof memory_editable_table_widget_1.MemoryEditableTableWidget,
126
- execute: (widgetToActOn, address) => widgetToActOn.resetModifiedValue(address),
127
- });
128
- registry.registerCommand(memory_commands_1.FollowPointerTableCommand, {
129
- isEnabled: (widgetToActOn, address, variable) => widgetToActOn instanceof memory_table_widget_1.MemoryTableWidget &&
130
- this.isPointer(variable === null || variable === void 0 ? void 0 : variable.type),
131
- isVisible: (widgetToActOn, address, variable) => widgetToActOn instanceof memory_table_widget_1.MemoryTableWidget &&
132
- this.isPointer(variable === null || variable === void 0 ? void 0 : variable.type),
133
- execute: (widgetToActOn, address, variable) => {
134
- if (variable === null || variable === void 0 ? void 0 : variable.name) {
135
- widgetToActOn.optionsWidget.setAddressAndGo(variable.name);
136
- }
137
- },
138
- });
139
- registry.registerCommand(memory_commands_1.CreateNewMemoryViewCommand, {
140
- isEnabled: w => this.withWidget(() => true, w),
141
- isVisible: w => this.withWidget(() => true, w),
142
- execute: () => this.memoryWidgetManager.createNewMemoryWidget(),
143
- });
144
- registry.registerCommand(memory_commands_1.CreateNewRegisterViewCommand, {
145
- isEnabled: w => this.withWidget(() => true, w),
146
- isVisible: w => this.withWidget(() => true, w),
147
- execute: () => this.memoryWidgetManager.createNewMemoryWidget('register'),
148
- });
149
- registry.registerCommand(memory_commands_1.RegisterSetVariableCommand, {
150
- isEnabled: (widgetToActOn, dVar) => widgetToActOn instanceof register_table_widget_1.RegisterTableWidget &&
151
- dVar && dVar.supportSetVariable,
152
- isVisible: (widgetToActOn, dVar) => widgetToActOn instanceof register_table_widget_1.RegisterTableWidget &&
153
- dVar && dVar.supportSetVariable,
154
- execute: (widgetToActOn, dVar) => dVar && widgetToActOn.handleSetValue(dVar),
155
- });
156
- registry.registerCommand(memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand, {
157
- isVisible: widget => this.withWidget(() => this.memoryWidgetManager.canCompare, widget),
158
- execute: (widget) => {
159
- widget.toggleComparisonVisibility();
160
- },
161
- });
162
- }
163
- isPointer(type) {
164
- return !!(type === null || type === void 0 ? void 0 : type.includes('*'));
165
- }
166
- /**
167
- * @param {string} addressReference Should be the exact string to be used in the address bar. I.e. it must resolve to an address value.
168
- */
169
- async openMemoryWidgetAt(addressReference) {
170
- await this.openView({ activate: false });
171
- const newWidget = await this.memoryWidgetManager.createNewMemoryWidget();
172
- await this.shell.activateWidget(newWidget.id);
173
- if (newWidget) {
174
- newWidget.optionsWidget.setAddressAndGo(addressReference);
175
- }
176
- return newWidget;
177
- }
178
- async openRegisterWidgetWithReg(name) {
179
- await this.openView({ activate: false });
180
- const newWidget = await this.memoryWidgetManager.createNewMemoryWidget('register');
181
- await this.shell.activateWidget(newWidget.id);
182
- if (newWidget) {
183
- newWidget.optionsWidget.setRegAndUpdate(name);
184
- }
185
- return newWidget;
186
- }
187
- withWidget(fn, widget = this.tryGetWidget()) {
188
- if (widget instanceof memory_layout_widget_1.MemoryLayoutWidget && widget.id === memory_layout_widget_1.MemoryLayoutWidget.ID) {
189
- return fn(widget);
190
- }
191
- return false;
192
- }
193
- registerMenus(registry) {
194
- super.registerMenus(registry);
195
- const registerMenuActions = (menuPath, ...commands) => {
196
- for (const [index, command] of commands.entries()) {
197
- registry.registerMenuAction(menuPath, {
198
- commandId: command.id,
199
- label: command.label,
200
- icon: command.iconClass,
201
- order: String.fromCharCode('a'.charCodeAt(0) + index),
202
- });
203
- }
204
- };
205
- registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.ViewVariableInMemoryCommand.id, label: memory_commands_1.ViewVariableInMemoryCommand.label });
206
- registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.FollowPointerDebugCommand.id, label: memory_commands_1.FollowPointerDebugCommand.label });
207
- registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.ViewVariableInRegisterViewCommand.id, label: memory_commands_1.ViewVariableInRegisterViewCommand.label });
208
- registry.registerMenuAction(memory_editable_table_widget_1.MemoryEditableTableWidget.CONTEXT_MENU, { commandId: memory_commands_1.ResetModifiedCellCommand.id, label: memory_commands_1.ResetModifiedCellCommand.label });
209
- registry.registerMenuAction(memory_table_widget_1.MemoryTableWidget.CONTEXT_MENU, { commandId: memory_commands_1.FollowPointerTableCommand.id, label: memory_commands_1.FollowPointerTableCommand.label });
210
- registerMenuActions(register_table_widget_1.RegisterTableWidget.CONTEXT_MENU, memory_commands_1.RegisterSetVariableCommand);
211
- }
212
- registerToolbarItems(toolbarRegistry) {
213
- toolbarRegistry.registerItem({
214
- id: memory_commands_1.CreateNewMemoryViewCommand.id,
215
- command: memory_commands_1.CreateNewMemoryViewCommand.id,
216
- tooltip: memory_commands_1.CreateNewMemoryViewCommand.label,
217
- priority: -2,
218
- });
219
- toolbarRegistry.registerItem({
220
- id: memory_commands_1.CreateNewRegisterViewCommand.id,
221
- command: memory_commands_1.CreateNewRegisterViewCommand.id,
222
- tooltip: memory_commands_1.CreateNewRegisterViewCommand.label,
223
- priority: -1,
224
- });
225
- toolbarRegistry.registerItem({
226
- id: memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand.id,
227
- command: memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand.id,
228
- tooltip: nls_1.nls.localize('theia/memory-inspector/toggleComparisonWidgetVisibility', 'Toggle Comparison Widget Visibility'),
229
- priority: -3,
230
- onDidChange: this.memoryWidgetManager.onChanged,
231
- });
232
- }
233
- registerColors(colorRegistry) {
234
- colorRegistry.register({
235
- id: 'memoryDiff.removedTextBackground',
236
- defaults: {
237
- dark: color_1.Color.transparent('diffEditor.removedTextBackground', ONE_HALF_OPACITY),
238
- light: color_1.Color.transparent('diffEditor.removedTextBackground', ONE_HALF_OPACITY),
239
- },
240
- description: 'A less opaque diff color for use in the Memory Inspector where various overlays may me in place at once.',
241
- }, {
242
- id: 'memoryDiff.insertedTextBackground',
243
- defaults: {
244
- dark: color_1.Color.transparent('diffEditor.insertedTextBackground', ONE_HALF_OPACITY),
245
- light: color_1.Color.transparent('diffEditor.insertedTextBackground', ONE_HALF_OPACITY),
246
- },
247
- description: 'A less opaque diff color for use in the Memory Inspector where various overlays may me in place at once.',
248
- }, {
249
- id: 'memoryInspector.focusBorder',
250
- defaults: {
251
- dark: color_1.Color.transparent('focusBorder', ONE_HALF_OPACITY),
252
- light: color_1.Color.transparent('focusBorder', ONE_HALF_OPACITY),
253
- },
254
- description: 'A less opaque focus border color for use in the Memory Inspector where several overlays may be in place at once.',
255
- }, {
256
- id: 'memoryInspector.foreground',
257
- defaults: {
258
- dark: color_1.Color.transparent('editor.foreground', ONE_HALF_OPACITY),
259
- light: color_1.Color.transparent('editor.foreground', ONE_HALF_OPACITY),
260
- },
261
- description: 'A less opaque foreground text style for use in the Memory Inspector',
262
- });
263
- }
264
- };
265
- __decorate([
266
- (0, inversify_1.inject)(debug_frontend_application_contribution_1.DebugFrontendApplicationContribution),
267
- __metadata("design:type", debug_frontend_application_contribution_1.DebugFrontendApplicationContribution)
268
- ], DebugFrontendContribution.prototype, "debugContribution", void 0);
269
- __decorate([
270
- (0, inversify_1.inject)(memory_widget_manager_1.MemoryWidgetManager),
271
- __metadata("design:type", memory_widget_manager_1.MemoryWidgetManager)
272
- ], DebugFrontendContribution.prototype, "memoryWidgetManager", void 0);
273
- __decorate([
274
- (0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService),
275
- __metadata("design:type", frontend_application_state_1.FrontendApplicationStateService)
276
- ], DebugFrontendContribution.prototype, "stateService", void 0);
277
- __decorate([
278
- (0, inversify_1.inject)(memory_provider_service_1.MemoryProviderService),
279
- __metadata("design:type", memory_provider_service_1.MemoryProviderService)
280
- ], DebugFrontendContribution.prototype, "memoryProvider", void 0);
281
- __decorate([
282
- (0, inversify_1.postConstruct)(),
283
- __metadata("design:type", Function),
284
- __metadata("design:paramtypes", []),
285
- __metadata("design:returntype", void 0)
286
- ], DebugFrontendContribution.prototype, "init", null);
287
- DebugFrontendContribution = __decorate([
288
- (0, inversify_1.injectable)(),
289
- __metadata("design:paramtypes", [])
290
- ], DebugFrontendContribution);
291
- exports.DebugFrontendContribution = DebugFrontendContribution;
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2019 Ericsson and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.DebugFrontendContribution = void 0;
28
+ const browser_1 = require("@theia/core/lib/browser");
29
+ const frontend_application_state_1 = require("@theia/core/lib/browser/frontend-application-state");
30
+ const color_1 = require("@theia/core/lib/common/color");
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ const debug_console_items_1 = require("@theia/debug/lib/browser/console/debug-console-items");
33
+ const debug_frontend_application_contribution_1 = require("@theia/debug/lib/browser/debug-frontend-application-contribution");
34
+ const debug_variables_widget_1 = require("@theia/debug/lib/browser/view/debug-variables-widget");
35
+ const Long = require("long");
36
+ const memory_editable_table_widget_1 = require("./editable-widget/memory-editable-table-widget");
37
+ const memory_provider_service_1 = require("./memory-provider/memory-provider-service");
38
+ const memory_table_widget_1 = require("./memory-widget/memory-table-widget");
39
+ const register_table_widget_1 = require("./register-widget/register-table-widget");
40
+ const memory_commands_1 = require("./utils/memory-commands");
41
+ const memory_widget_manager_1 = require("./utils/memory-widget-manager");
42
+ const memory_dock_panel_1 = require("./wrapper-widgets/memory-dock-panel");
43
+ const memory_layout_widget_1 = require("./wrapper-widgets/memory-layout-widget");
44
+ const nls_1 = require("@theia/core/lib/common/nls");
45
+ const ONE_HALF_OPACITY = 0.5;
46
+ let DebugFrontendContribution = class DebugFrontendContribution extends browser_1.AbstractViewContribution {
47
+ constructor() {
48
+ super({
49
+ widgetId: memory_layout_widget_1.MemoryLayoutWidget.ID,
50
+ widgetName: memory_layout_widget_1.MemoryLayoutWidget.LABEL,
51
+ defaultWidgetOptions: {
52
+ area: 'right',
53
+ },
54
+ toggleCommandId: memory_commands_1.MemoryCommand.id,
55
+ });
56
+ }
57
+ init() {
58
+ this.stateService.reachedState('initialized_layout').then(() => {
59
+ // Close leftover widgets from previous sessions.
60
+ this.memoryWidgetManager.availableWidgets.forEach(widget => {
61
+ if (!(widget.parent instanceof memory_dock_panel_1.MemoryDockPanel)) {
62
+ widget.close();
63
+ }
64
+ });
65
+ });
66
+ }
67
+ async initializeLayout() {
68
+ await this.openView({ activate: false });
69
+ }
70
+ registerCommands(registry) {
71
+ super.registerCommands(registry);
72
+ registry.registerCommand(memory_commands_1.ViewVariableInMemoryCommand, {
73
+ execute: async () => {
74
+ const { selectedVariable } = this.debugContribution;
75
+ const referenceText = this.memoryProvider.formatVariableReference(selectedVariable);
76
+ if (referenceText) {
77
+ await this.openMemoryWidgetAt(referenceText);
78
+ }
79
+ },
80
+ isVisible: () => {
81
+ const { selectedVariable } = this.debugContribution;
82
+ return Boolean(this.memoryProvider.supportsVariableReferenceSyntax(selectedVariable) && this.memoryProvider.formatVariableReference(selectedVariable));
83
+ },
84
+ });
85
+ registry.registerCommand(memory_commands_1.ViewVariableInRegisterViewCommand, {
86
+ execute: async () => {
87
+ var _a;
88
+ const name = (_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.name;
89
+ if (name) {
90
+ await this.openRegisterWidgetWithReg(name);
91
+ }
92
+ },
93
+ isVisible: () => {
94
+ var _a, _b;
95
+ let { selectedVariable: currentLevel } = this.debugContribution;
96
+ if (!currentLevel) {
97
+ return false;
98
+ }
99
+ // Make sure it looks like it has a numerical value.
100
+ try {
101
+ BigInt(currentLevel.value);
102
+ }
103
+ catch {
104
+ return false;
105
+ }
106
+ while (currentLevel.parent instanceof debug_console_items_1.DebugVariable) {
107
+ currentLevel = currentLevel.parent;
108
+ }
109
+ return currentLevel.parent instanceof debug_console_items_1.DebugScope && ((_b = (_a = currentLevel.parent) === null || _a === void 0 ? void 0 : _a['raw']) === null || _b === void 0 ? void 0 : _b.name) === 'Registers';
110
+ },
111
+ });
112
+ registry.registerCommand(memory_commands_1.FollowPointerDebugCommand, {
113
+ isVisible: () => { var _a; return !!this.isPointer((_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.type); },
114
+ isEnabled: () => { var _a; return !!this.isPointer((_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.type); },
115
+ execute: async () => {
116
+ var _a;
117
+ const name = (_a = this.debugContribution.selectedVariable) === null || _a === void 0 ? void 0 : _a.name;
118
+ if (name) {
119
+ await this.openMemoryWidgetAt(name);
120
+ }
121
+ },
122
+ });
123
+ registry.registerCommand(memory_commands_1.ResetModifiedCellCommand, {
124
+ isEnabled: (widgetToActOn, address) => Long.isLong(address) && widgetToActOn instanceof memory_editable_table_widget_1.MemoryEditableTableWidget,
125
+ isVisible: (widgetToActOn, address) => Long.isLong(address) && widgetToActOn instanceof memory_editable_table_widget_1.MemoryEditableTableWidget,
126
+ execute: (widgetToActOn, address) => widgetToActOn.resetModifiedValue(address),
127
+ });
128
+ registry.registerCommand(memory_commands_1.FollowPointerTableCommand, {
129
+ isEnabled: (widgetToActOn, address, variable) => widgetToActOn instanceof memory_table_widget_1.MemoryTableWidget &&
130
+ this.isPointer(variable === null || variable === void 0 ? void 0 : variable.type),
131
+ isVisible: (widgetToActOn, address, variable) => widgetToActOn instanceof memory_table_widget_1.MemoryTableWidget &&
132
+ this.isPointer(variable === null || variable === void 0 ? void 0 : variable.type),
133
+ execute: (widgetToActOn, address, variable) => {
134
+ if (variable === null || variable === void 0 ? void 0 : variable.name) {
135
+ widgetToActOn.optionsWidget.setAddressAndGo(variable.name);
136
+ }
137
+ },
138
+ });
139
+ registry.registerCommand(memory_commands_1.CreateNewMemoryViewCommand, {
140
+ isEnabled: w => this.withWidget(() => true, w),
141
+ isVisible: w => this.withWidget(() => true, w),
142
+ execute: () => this.memoryWidgetManager.createNewMemoryWidget(),
143
+ });
144
+ registry.registerCommand(memory_commands_1.CreateNewRegisterViewCommand, {
145
+ isEnabled: w => this.withWidget(() => true, w),
146
+ isVisible: w => this.withWidget(() => true, w),
147
+ execute: () => this.memoryWidgetManager.createNewMemoryWidget('register'),
148
+ });
149
+ registry.registerCommand(memory_commands_1.RegisterSetVariableCommand, {
150
+ isEnabled: (widgetToActOn, dVar) => widgetToActOn instanceof register_table_widget_1.RegisterTableWidget &&
151
+ dVar && dVar.supportSetVariable,
152
+ isVisible: (widgetToActOn, dVar) => widgetToActOn instanceof register_table_widget_1.RegisterTableWidget &&
153
+ dVar && dVar.supportSetVariable,
154
+ execute: (widgetToActOn, dVar) => dVar && widgetToActOn.handleSetValue(dVar),
155
+ });
156
+ registry.registerCommand(memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand, {
157
+ isVisible: widget => this.withWidget(() => this.memoryWidgetManager.canCompare, widget),
158
+ execute: (widget) => {
159
+ widget.toggleComparisonVisibility();
160
+ },
161
+ });
162
+ }
163
+ isPointer(type) {
164
+ return !!(type === null || type === void 0 ? void 0 : type.includes('*'));
165
+ }
166
+ /**
167
+ * @param {string} addressReference Should be the exact string to be used in the address bar. I.e. it must resolve to an address value.
168
+ */
169
+ async openMemoryWidgetAt(addressReference) {
170
+ await this.openView({ activate: false });
171
+ const newWidget = await this.memoryWidgetManager.createNewMemoryWidget();
172
+ await this.shell.activateWidget(newWidget.id);
173
+ if (newWidget) {
174
+ newWidget.optionsWidget.setAddressAndGo(addressReference);
175
+ }
176
+ return newWidget;
177
+ }
178
+ async openRegisterWidgetWithReg(name) {
179
+ await this.openView({ activate: false });
180
+ const newWidget = await this.memoryWidgetManager.createNewMemoryWidget('register');
181
+ await this.shell.activateWidget(newWidget.id);
182
+ if (newWidget) {
183
+ newWidget.optionsWidget.setRegAndUpdate(name);
184
+ }
185
+ return newWidget;
186
+ }
187
+ withWidget(fn, widget = this.tryGetWidget()) {
188
+ if (widget instanceof memory_layout_widget_1.MemoryLayoutWidget && widget.id === memory_layout_widget_1.MemoryLayoutWidget.ID) {
189
+ return fn(widget);
190
+ }
191
+ return false;
192
+ }
193
+ registerMenus(registry) {
194
+ super.registerMenus(registry);
195
+ const registerMenuActions = (menuPath, ...commands) => {
196
+ for (const [index, command] of commands.entries()) {
197
+ registry.registerMenuAction(menuPath, {
198
+ commandId: command.id,
199
+ label: command.label,
200
+ icon: command.iconClass,
201
+ order: String.fromCharCode('a'.charCodeAt(0) + index),
202
+ });
203
+ }
204
+ };
205
+ registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.ViewVariableInMemoryCommand.id, label: memory_commands_1.ViewVariableInMemoryCommand.label });
206
+ registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.FollowPointerDebugCommand.id, label: memory_commands_1.FollowPointerDebugCommand.label });
207
+ registry.registerMenuAction(debug_variables_widget_1.DebugVariablesWidget.WATCH_MENU, { commandId: memory_commands_1.ViewVariableInRegisterViewCommand.id, label: memory_commands_1.ViewVariableInRegisterViewCommand.label });
208
+ registry.registerMenuAction(memory_editable_table_widget_1.MemoryEditableTableWidget.CONTEXT_MENU, { commandId: memory_commands_1.ResetModifiedCellCommand.id, label: memory_commands_1.ResetModifiedCellCommand.label });
209
+ registry.registerMenuAction(memory_table_widget_1.MemoryTableWidget.CONTEXT_MENU, { commandId: memory_commands_1.FollowPointerTableCommand.id, label: memory_commands_1.FollowPointerTableCommand.label });
210
+ registerMenuActions(register_table_widget_1.RegisterTableWidget.CONTEXT_MENU, memory_commands_1.RegisterSetVariableCommand);
211
+ }
212
+ registerToolbarItems(toolbarRegistry) {
213
+ toolbarRegistry.registerItem({
214
+ id: memory_commands_1.CreateNewMemoryViewCommand.id,
215
+ command: memory_commands_1.CreateNewMemoryViewCommand.id,
216
+ tooltip: memory_commands_1.CreateNewMemoryViewCommand.label,
217
+ priority: -2,
218
+ });
219
+ toolbarRegistry.registerItem({
220
+ id: memory_commands_1.CreateNewRegisterViewCommand.id,
221
+ command: memory_commands_1.CreateNewRegisterViewCommand.id,
222
+ tooltip: memory_commands_1.CreateNewRegisterViewCommand.label,
223
+ priority: -1,
224
+ });
225
+ toolbarRegistry.registerItem({
226
+ id: memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand.id,
227
+ command: memory_commands_1.ToggleDiffSelectWidgetVisibilityCommand.id,
228
+ tooltip: nls_1.nls.localize('theia/memory-inspector/toggleComparisonWidgetVisibility', 'Toggle Comparison Widget Visibility'),
229
+ priority: -3,
230
+ onDidChange: this.memoryWidgetManager.onChanged,
231
+ });
232
+ }
233
+ registerColors(colorRegistry) {
234
+ colorRegistry.register({
235
+ id: 'memoryDiff.removedTextBackground',
236
+ defaults: {
237
+ dark: color_1.Color.transparent('diffEditor.removedTextBackground', ONE_HALF_OPACITY),
238
+ light: color_1.Color.transparent('diffEditor.removedTextBackground', ONE_HALF_OPACITY),
239
+ },
240
+ description: 'A less opaque diff color for use in the Memory Inspector where various overlays may me in place at once.',
241
+ }, {
242
+ id: 'memoryDiff.insertedTextBackground',
243
+ defaults: {
244
+ dark: color_1.Color.transparent('diffEditor.insertedTextBackground', ONE_HALF_OPACITY),
245
+ light: color_1.Color.transparent('diffEditor.insertedTextBackground', ONE_HALF_OPACITY),
246
+ },
247
+ description: 'A less opaque diff color for use in the Memory Inspector where various overlays may me in place at once.',
248
+ }, {
249
+ id: 'memoryInspector.focusBorder',
250
+ defaults: {
251
+ dark: color_1.Color.transparent('focusBorder', ONE_HALF_OPACITY),
252
+ light: color_1.Color.transparent('focusBorder', ONE_HALF_OPACITY),
253
+ },
254
+ description: 'A less opaque focus border color for use in the Memory Inspector where several overlays may be in place at once.',
255
+ }, {
256
+ id: 'memoryInspector.foreground',
257
+ defaults: {
258
+ dark: color_1.Color.transparent('editor.foreground', ONE_HALF_OPACITY),
259
+ light: color_1.Color.transparent('editor.foreground', ONE_HALF_OPACITY),
260
+ },
261
+ description: 'A less opaque foreground text style for use in the Memory Inspector',
262
+ });
263
+ }
264
+ };
265
+ __decorate([
266
+ (0, inversify_1.inject)(debug_frontend_application_contribution_1.DebugFrontendApplicationContribution),
267
+ __metadata("design:type", debug_frontend_application_contribution_1.DebugFrontendApplicationContribution)
268
+ ], DebugFrontendContribution.prototype, "debugContribution", void 0);
269
+ __decorate([
270
+ (0, inversify_1.inject)(memory_widget_manager_1.MemoryWidgetManager),
271
+ __metadata("design:type", memory_widget_manager_1.MemoryWidgetManager)
272
+ ], DebugFrontendContribution.prototype, "memoryWidgetManager", void 0);
273
+ __decorate([
274
+ (0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService),
275
+ __metadata("design:type", frontend_application_state_1.FrontendApplicationStateService)
276
+ ], DebugFrontendContribution.prototype, "stateService", void 0);
277
+ __decorate([
278
+ (0, inversify_1.inject)(memory_provider_service_1.MemoryProviderService),
279
+ __metadata("design:type", memory_provider_service_1.MemoryProviderService)
280
+ ], DebugFrontendContribution.prototype, "memoryProvider", void 0);
281
+ __decorate([
282
+ (0, inversify_1.postConstruct)(),
283
+ __metadata("design:type", Function),
284
+ __metadata("design:paramtypes", []),
285
+ __metadata("design:returntype", void 0)
286
+ ], DebugFrontendContribution.prototype, "init", null);
287
+ DebugFrontendContribution = __decorate([
288
+ (0, inversify_1.injectable)(),
289
+ __metadata("design:paramtypes", [])
290
+ ], DebugFrontendContribution);
291
+ exports.DebugFrontendContribution = DebugFrontendContribution;
292
292
  //# sourceMappingURL=memory-inspector-frontend-contribution.js.map
@@ -1,22 +1,22 @@
1
- /********************************************************************************
2
- * Copyright (C) 2019 Ericsson and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import '../../src/browser/register-widget/register-widget.css';
17
- import '../../src/browser/style/index.css';
18
- import '../../src/browser/utils/multi-select-bar.css';
19
- import { ContainerModule } from '@theia/core/shared/inversify';
20
- declare const _default: ContainerModule;
21
- export default _default;
1
+ /********************************************************************************
2
+ * Copyright (C) 2019 Ericsson and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import '../../src/browser/register-widget/register-widget.css';
17
+ import '../../src/browser/style/index.css';
18
+ import '../../src/browser/utils/multi-select-bar.css';
19
+ import { ContainerModule } from '@theia/core/shared/inversify';
20
+ declare const _default: ContainerModule;
21
+ export default _default;
22
22
  //# sourceMappingURL=memory-inspector-frontend-module.d.ts.map