@codingame/monaco-vscode-debug-service-override 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +2 -2
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +73 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1026 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +1004 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +337 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +432 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1039 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +649 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +64 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +636 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +740 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +408 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +80 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +169 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1271 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1330 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +115 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +77 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +307 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +31 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +387 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +267 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +817 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +131 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +142 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +262 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +669 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +709 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1002 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +352 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +129 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +734 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +501 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +162 -0
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +110 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +62 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +460 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +166 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +150 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +289 -0
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +64 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +311 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +29 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { append, addStandardDisposableListener, isAncestorOfActiveElement, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { DomScrollableElement } from 'vscode/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
4
|
+
import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
|
|
5
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { clamp } from 'vscode/vscode/vs/base/common/numbers';
|
|
8
|
+
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
9
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
10
|
+
import { ModelDecorationOptions } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
11
|
+
import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
|
|
12
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
13
|
+
import { MenuId, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
14
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
16
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
17
|
+
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
18
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
19
|
+
import { asCssVariable } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
20
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
21
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
22
|
+
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
23
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
24
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
25
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
26
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
27
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
28
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
29
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
30
|
+
import { renderExpressionValue, AbstractExpressionDataSource } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
|
|
31
|
+
import { LinkDetector } from './linkDetector.js';
|
|
32
|
+
import { VariablesRenderer, VisualizedVariableRenderer, openContextMenuForVariableTreeElement } from './variablesView.js';
|
|
33
|
+
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
34
|
+
import { Variable, Expression, VisualizedExpression } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
|
|
35
|
+
import { getEvaluatableExpressionAtPosition } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugUtils';
|
|
36
|
+
|
|
37
|
+
var DebugHoverWidget_1;
|
|
38
|
+
const $ = $$1;
|
|
39
|
+
async function doFindExpression(container, namesToFind) {
|
|
40
|
+
if (!container) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const children = await container.getChildren();
|
|
44
|
+
const filtered = children.filter(v => namesToFind[0] === v.name);
|
|
45
|
+
if (filtered.length !== 1) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (namesToFind.length === 1) {
|
|
49
|
+
return filtered[0];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return doFindExpression(filtered[0], namesToFind.slice(1));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function findExpressionInStackFrame(stackFrame, namesToFind) {
|
|
56
|
+
const scopes = await stackFrame.getScopes();
|
|
57
|
+
const nonExpensive = scopes.filter(s => !s.expensive);
|
|
58
|
+
const expressions = coalesce(await Promise.all(( nonExpensive.map(scope => doFindExpression(scope, namesToFind)))));
|
|
59
|
+
return expressions.length > 0 && expressions.every(e => e.value === expressions[0].value) ? expressions[0] : undefined;
|
|
60
|
+
}
|
|
61
|
+
let DebugHoverWidget = class DebugHoverWidget {
|
|
62
|
+
static { DebugHoverWidget_1 = this; }
|
|
63
|
+
static { this.ID = 'debug.hoverWidget'; }
|
|
64
|
+
get isShowingComplexValue() {
|
|
65
|
+
return this.complexValueContainer?.hidden === false;
|
|
66
|
+
}
|
|
67
|
+
constructor(editor, debugService, instantiationService, menuService, contextKeyService, contextMenuService) {
|
|
68
|
+
this.editor = editor;
|
|
69
|
+
this.debugService = debugService;
|
|
70
|
+
this.instantiationService = instantiationService;
|
|
71
|
+
this.menuService = menuService;
|
|
72
|
+
this.contextKeyService = contextKeyService;
|
|
73
|
+
this.contextMenuService = contextMenuService;
|
|
74
|
+
this.allowEditorOverflow = true;
|
|
75
|
+
this.highlightDecorations = this.editor.createDecorationsCollection();
|
|
76
|
+
this.isUpdatingTree = false;
|
|
77
|
+
this.toDispose = [];
|
|
78
|
+
this._isVisible = false;
|
|
79
|
+
this.showAtPosition = null;
|
|
80
|
+
this.positionPreference = [1 , 2 ];
|
|
81
|
+
this.debugHoverComputer = this.instantiationService.createInstance(DebugHoverComputer, this.editor);
|
|
82
|
+
}
|
|
83
|
+
create() {
|
|
84
|
+
this.domNode = $('.debug-hover-widget');
|
|
85
|
+
this.complexValueContainer = append(this.domNode, $('.complex-value'));
|
|
86
|
+
this.complexValueTitle = append(this.complexValueContainer, $('.title'));
|
|
87
|
+
this.treeContainer = append(this.complexValueContainer, $('.debug-hover-tree'));
|
|
88
|
+
this.treeContainer.setAttribute('role', 'tree');
|
|
89
|
+
const tip = append(this.complexValueContainer, $('.tip'));
|
|
90
|
+
tip.textContent = ( localizeWithPath(
|
|
91
|
+
'vs/workbench/contrib/debug/browser/debugHover',
|
|
92
|
+
{ key: 'quickTip', comment: ['"switch to editor language hover" means to show the programming language hover widget instead of the debug hover'] },
|
|
93
|
+
'Hold {0} key to switch to editor language hover',
|
|
94
|
+
isMacintosh ? 'Option' : 'Alt'
|
|
95
|
+
));
|
|
96
|
+
const dataSource = this.instantiationService.createInstance(DebugHoverDataSource);
|
|
97
|
+
const linkeDetector = this.instantiationService.createInstance(LinkDetector);
|
|
98
|
+
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'DebugHover', this.treeContainer, ( new DebugHoverDelegate()), [
|
|
99
|
+
this.instantiationService.createInstance(VariablesRenderer, linkeDetector),
|
|
100
|
+
this.instantiationService.createInstance(VisualizedVariableRenderer, linkeDetector),
|
|
101
|
+
], dataSource, {
|
|
102
|
+
accessibilityProvider: ( new DebugHoverAccessibilityProvider()),
|
|
103
|
+
mouseSupport: false,
|
|
104
|
+
horizontalScrolling: true,
|
|
105
|
+
useShadows: false,
|
|
106
|
+
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e) => e.name },
|
|
107
|
+
overrideStyles: {
|
|
108
|
+
listBackground: editorHoverBackground
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
this.toDispose.push(VisualizedVariableRenderer.rendererOnVisualizationRange(this.debugService.getViewModel(), this.tree));
|
|
112
|
+
this.valueContainer = $('.value');
|
|
113
|
+
this.valueContainer.tabIndex = 0;
|
|
114
|
+
this.valueContainer.setAttribute('role', 'tooltip');
|
|
115
|
+
this.scrollbar = ( new DomScrollableElement(this.valueContainer, { horizontal: 2 }));
|
|
116
|
+
this.domNode.appendChild(this.scrollbar.getDomNode());
|
|
117
|
+
this.toDispose.push(this.scrollbar);
|
|
118
|
+
this.editor.applyFontInfo(this.domNode);
|
|
119
|
+
this.domNode.style.backgroundColor = asCssVariable(editorHoverBackground);
|
|
120
|
+
this.domNode.style.border = `1px solid ${asCssVariable(editorHoverBorder)}`;
|
|
121
|
+
this.domNode.style.color = asCssVariable(editorHoverForeground);
|
|
122
|
+
this.toDispose.push(this.tree.onContextMenu(async (e) => await this.onContextMenu(e)));
|
|
123
|
+
this.toDispose.push(this.tree.onDidChangeContentHeight(() => {
|
|
124
|
+
if (!this.isUpdatingTree) {
|
|
125
|
+
this.layoutTreeAndContainer();
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
this.toDispose.push(this.tree.onDidChangeContentWidth(() => {
|
|
129
|
+
if (!this.isUpdatingTree) {
|
|
130
|
+
this.layoutTreeAndContainer();
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
this.registerListeners();
|
|
134
|
+
this.editor.addContentWidget(this);
|
|
135
|
+
}
|
|
136
|
+
async onContextMenu(e) {
|
|
137
|
+
const variable = e.element;
|
|
138
|
+
if (!(variable instanceof Variable) || !variable.value) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
return openContextMenuForVariableTreeElement(this.contextKeyService, this.menuService, this.contextMenuService, MenuId.DebugHoverContext, e);
|
|
142
|
+
}
|
|
143
|
+
registerListeners() {
|
|
144
|
+
this.toDispose.push(addStandardDisposableListener(this.domNode, 'keydown', (e) => {
|
|
145
|
+
if (e.equals(9 )) {
|
|
146
|
+
this.hide();
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
this.toDispose.push(this.editor.onDidChangeConfiguration((e) => {
|
|
150
|
+
if (e.hasChanged(50 )) {
|
|
151
|
+
this.editor.applyFontInfo(this.domNode);
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(async (e) => {
|
|
155
|
+
if (e instanceof Variable && this.tree.hasNode(e)) {
|
|
156
|
+
await this.tree.updateChildren(e, false, true);
|
|
157
|
+
await this.tree.expand(e);
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
isHovered() {
|
|
162
|
+
return !!this.domNode?.matches(':hover');
|
|
163
|
+
}
|
|
164
|
+
isVisible() {
|
|
165
|
+
return this._isVisible;
|
|
166
|
+
}
|
|
167
|
+
willBeVisible() {
|
|
168
|
+
return !!this.showCancellationSource;
|
|
169
|
+
}
|
|
170
|
+
getId() {
|
|
171
|
+
return DebugHoverWidget_1.ID;
|
|
172
|
+
}
|
|
173
|
+
getDomNode() {
|
|
174
|
+
return this.domNode;
|
|
175
|
+
}
|
|
176
|
+
async showAt(position, focus) {
|
|
177
|
+
this.showCancellationSource?.cancel();
|
|
178
|
+
const cancellationSource = this.showCancellationSource = ( new CancellationTokenSource());
|
|
179
|
+
const session = this.debugService.getViewModel().focusedSession;
|
|
180
|
+
if (!session || !this.editor.hasModel()) {
|
|
181
|
+
this.hide();
|
|
182
|
+
return 1 ;
|
|
183
|
+
}
|
|
184
|
+
const result = await this.debugHoverComputer.compute(position, cancellationSource.token);
|
|
185
|
+
if (cancellationSource.token.isCancellationRequested) {
|
|
186
|
+
this.hide();
|
|
187
|
+
return 2 ;
|
|
188
|
+
}
|
|
189
|
+
if (!result.range) {
|
|
190
|
+
this.hide();
|
|
191
|
+
return 1 ;
|
|
192
|
+
}
|
|
193
|
+
if (this.isVisible() && !result.rangeChanged) {
|
|
194
|
+
return 0 ;
|
|
195
|
+
}
|
|
196
|
+
const expression = await this.debugHoverComputer.evaluate(session);
|
|
197
|
+
if (cancellationSource.token.isCancellationRequested) {
|
|
198
|
+
this.hide();
|
|
199
|
+
return 2 ;
|
|
200
|
+
}
|
|
201
|
+
if (!expression || (expression instanceof Expression && !expression.available)) {
|
|
202
|
+
this.hide();
|
|
203
|
+
return 1 ;
|
|
204
|
+
}
|
|
205
|
+
this.highlightDecorations.set([{
|
|
206
|
+
range: result.range,
|
|
207
|
+
options: DebugHoverWidget_1._HOVER_HIGHLIGHT_DECORATION_OPTIONS
|
|
208
|
+
}]);
|
|
209
|
+
return this.doShow(result.range.getStartPosition(), expression, focus);
|
|
210
|
+
}
|
|
211
|
+
static { this._HOVER_HIGHLIGHT_DECORATION_OPTIONS = ModelDecorationOptions.register({
|
|
212
|
+
description: 'bdebug-hover-highlight',
|
|
213
|
+
className: 'hoverHighlight'
|
|
214
|
+
}); }
|
|
215
|
+
async doShow(position, expression, focus, forceValueHover = false) {
|
|
216
|
+
if (!this.domNode) {
|
|
217
|
+
this.create();
|
|
218
|
+
}
|
|
219
|
+
this.showAtPosition = position;
|
|
220
|
+
this._isVisible = true;
|
|
221
|
+
if (!expression.hasChildren || forceValueHover) {
|
|
222
|
+
this.complexValueContainer.hidden = true;
|
|
223
|
+
this.valueContainer.hidden = false;
|
|
224
|
+
renderExpressionValue(expression, this.valueContainer, {
|
|
225
|
+
showChanged: false,
|
|
226
|
+
colorize: true
|
|
227
|
+
});
|
|
228
|
+
this.valueContainer.title = '';
|
|
229
|
+
this.editor.layoutContentWidget(this);
|
|
230
|
+
this.scrollbar.scanDomNode();
|
|
231
|
+
if (focus) {
|
|
232
|
+
this.editor.render();
|
|
233
|
+
this.valueContainer.focus();
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
this.valueContainer.hidden = true;
|
|
238
|
+
this.expressionToRender = expression;
|
|
239
|
+
this.complexValueTitle.textContent = expression.value;
|
|
240
|
+
this.complexValueTitle.title = expression.value;
|
|
241
|
+
this.editor.layoutContentWidget(this);
|
|
242
|
+
this.tree.scrollTop = 0;
|
|
243
|
+
this.tree.scrollLeft = 0;
|
|
244
|
+
this.complexValueContainer.hidden = false;
|
|
245
|
+
if (focus) {
|
|
246
|
+
this.editor.render();
|
|
247
|
+
this.tree.domFocus();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
layoutTreeAndContainer() {
|
|
251
|
+
this.layoutTree();
|
|
252
|
+
this.editor.layoutContentWidget(this);
|
|
253
|
+
}
|
|
254
|
+
layoutTree() {
|
|
255
|
+
const scrollBarHeight = 10;
|
|
256
|
+
let maxHeightToAvoidCursorOverlay = Infinity;
|
|
257
|
+
if (this.showAtPosition) {
|
|
258
|
+
const editorTop = this.editor.getDomNode()?.offsetTop || 0;
|
|
259
|
+
const containerTop = this.treeContainer.offsetTop + editorTop;
|
|
260
|
+
const hoveredCharTop = this.editor.getTopForLineNumber(this.showAtPosition.lineNumber, true) - this.editor.getScrollTop();
|
|
261
|
+
if (containerTop < hoveredCharTop) {
|
|
262
|
+
maxHeightToAvoidCursorOverlay = hoveredCharTop + editorTop - 22;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const treeHeight = Math.min(Math.max(266, this.editor.getLayoutInfo().height * 0.55), this.tree.contentHeight + scrollBarHeight, maxHeightToAvoidCursorOverlay);
|
|
266
|
+
const realTreeWidth = this.tree.contentWidth;
|
|
267
|
+
const treeWidth = clamp(realTreeWidth, 400, 550);
|
|
268
|
+
this.tree.layout(treeHeight, treeWidth);
|
|
269
|
+
this.treeContainer.style.height = `${treeHeight}px`;
|
|
270
|
+
this.scrollbar.scanDomNode();
|
|
271
|
+
}
|
|
272
|
+
beforeRender() {
|
|
273
|
+
if (this.expressionToRender) {
|
|
274
|
+
const expression = this.expressionToRender;
|
|
275
|
+
this.expressionToRender = undefined;
|
|
276
|
+
this.isUpdatingTree = true;
|
|
277
|
+
this.tree.setInput(expression).finally(() => {
|
|
278
|
+
this.isUpdatingTree = false;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
afterRender(positionPreference) {
|
|
284
|
+
if (positionPreference) {
|
|
285
|
+
this.positionPreference = [positionPreference];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
hide() {
|
|
289
|
+
if (this.showCancellationSource) {
|
|
290
|
+
this.showCancellationSource.cancel();
|
|
291
|
+
this.showCancellationSource = undefined;
|
|
292
|
+
}
|
|
293
|
+
if (!this._isVisible) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (isAncestorOfActiveElement(this.domNode)) {
|
|
297
|
+
this.editor.focus();
|
|
298
|
+
}
|
|
299
|
+
this._isVisible = false;
|
|
300
|
+
this.highlightDecorations.clear();
|
|
301
|
+
this.editor.layoutContentWidget(this);
|
|
302
|
+
this.positionPreference = [1 , 2 ];
|
|
303
|
+
}
|
|
304
|
+
getPosition() {
|
|
305
|
+
return this._isVisible ? {
|
|
306
|
+
position: this.showAtPosition,
|
|
307
|
+
preference: this.positionPreference
|
|
308
|
+
} : null;
|
|
309
|
+
}
|
|
310
|
+
dispose() {
|
|
311
|
+
this.toDispose = dispose(this.toDispose);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
DebugHoverWidget = DebugHoverWidget_1 = ( __decorate([
|
|
315
|
+
( __param(1, IDebugService)),
|
|
316
|
+
( __param(2, IInstantiationService)),
|
|
317
|
+
( __param(3, IMenuService)),
|
|
318
|
+
( __param(4, IContextKeyService)),
|
|
319
|
+
( __param(5, IContextMenuService))
|
|
320
|
+
], DebugHoverWidget));
|
|
321
|
+
class DebugHoverAccessibilityProvider {
|
|
322
|
+
getWidgetAriaLabel() {
|
|
323
|
+
return ( localizeWithPath(
|
|
324
|
+
'vs/workbench/contrib/debug/browser/debugHover',
|
|
325
|
+
'treeAriaLabel',
|
|
326
|
+
"Debug Hover"
|
|
327
|
+
));
|
|
328
|
+
}
|
|
329
|
+
getAriaLabel(element) {
|
|
330
|
+
return ( localizeWithPath(
|
|
331
|
+
'vs/workbench/contrib/debug/browser/debugHover',
|
|
332
|
+
{ key: 'variableAriaLabel', comment: ['Do not translate placeholders. Placeholders are name and value of a variable.'] },
|
|
333
|
+
"{0}, value {1}, variables, debug",
|
|
334
|
+
element.name,
|
|
335
|
+
element.value
|
|
336
|
+
));
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
class DebugHoverDataSource extends AbstractExpressionDataSource {
|
|
340
|
+
hasChildren(element) {
|
|
341
|
+
return element.hasChildren;
|
|
342
|
+
}
|
|
343
|
+
doGetChildren(element) {
|
|
344
|
+
return element.getChildren();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
class DebugHoverDelegate {
|
|
348
|
+
getHeight(element) {
|
|
349
|
+
return 18;
|
|
350
|
+
}
|
|
351
|
+
getTemplateId(element) {
|
|
352
|
+
if (element instanceof VisualizedExpression) {
|
|
353
|
+
return VisualizedVariableRenderer.ID;
|
|
354
|
+
}
|
|
355
|
+
return VariablesRenderer.ID;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
let DebugHoverComputer = class DebugHoverComputer {
|
|
359
|
+
constructor(editor, debugService, languageFeaturesService, logService) {
|
|
360
|
+
this.editor = editor;
|
|
361
|
+
this.debugService = debugService;
|
|
362
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
363
|
+
this.logService = logService;
|
|
364
|
+
}
|
|
365
|
+
async compute(position, token) {
|
|
366
|
+
const session = this.debugService.getViewModel().focusedSession;
|
|
367
|
+
if (!session || !this.editor.hasModel()) {
|
|
368
|
+
return { rangeChanged: false };
|
|
369
|
+
}
|
|
370
|
+
const model = this.editor.getModel();
|
|
371
|
+
const result = await getEvaluatableExpressionAtPosition(this.languageFeaturesService, model, position, token);
|
|
372
|
+
if (!result) {
|
|
373
|
+
return { rangeChanged: false };
|
|
374
|
+
}
|
|
375
|
+
const { range, matchingExpression } = result;
|
|
376
|
+
const rangeChanged = this._currentRange ?
|
|
377
|
+
!this._currentRange.equalsRange(range) :
|
|
378
|
+
true;
|
|
379
|
+
this._currentExpression = matchingExpression;
|
|
380
|
+
this._currentRange = Range.lift(range);
|
|
381
|
+
return { rangeChanged, range: this._currentRange };
|
|
382
|
+
}
|
|
383
|
+
async evaluate(session) {
|
|
384
|
+
if (!this._currentExpression) {
|
|
385
|
+
this.logService.error('No expression to evaluate');
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (session.capabilities.supportsEvaluateForHovers) {
|
|
389
|
+
const expression = ( new Expression(this._currentExpression));
|
|
390
|
+
await expression.evaluate(session, this.debugService.getViewModel().focusedStackFrame, 'hover');
|
|
391
|
+
return expression;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
395
|
+
if (focusedStackFrame) {
|
|
396
|
+
return await findExpressionInStackFrame(focusedStackFrame, coalesce(( this._currentExpression.split('.').map(word => word.trim()))));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return undefined;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
DebugHoverComputer = ( __decorate([
|
|
403
|
+
( __param(1, IDebugService)),
|
|
404
|
+
( __param(2, ILanguageFeaturesService)),
|
|
405
|
+
( __param(3, ILogService))
|
|
406
|
+
], DebugHoverComputer));
|
|
407
|
+
|
|
408
|
+
export { DebugHoverWidget, findExpressionInStackFrame };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
2
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { toDisposable, DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { clamp } from 'vscode/vscode/vs/base/common/numbers';
|
|
5
|
+
import { assertNever } from 'vscode/vscode/vs/base/common/assert';
|
|
6
|
+
import { FileType, FilePermission, createFileSystemProviderError, FileSystemProviderErrorCode } from 'vscode/vscode/vs/platform/files/common/files';
|
|
7
|
+
import { DEBUG_MEMORY_SCHEME } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
8
|
+
|
|
9
|
+
const rangeRe = /range=([0-9]+):([0-9]+)/;
|
|
10
|
+
class DebugMemoryFileSystemProvider {
|
|
11
|
+
constructor(debugService) {
|
|
12
|
+
this.debugService = debugService;
|
|
13
|
+
this.memoryFdCounter = 0;
|
|
14
|
+
this.fdMemory = ( new Map());
|
|
15
|
+
this.changeEmitter = ( new Emitter());
|
|
16
|
+
this.onDidChangeCapabilities = Event.None;
|
|
17
|
+
this.onDidChangeFile = this.changeEmitter.event;
|
|
18
|
+
this.capabilities = 0
|
|
19
|
+
| 1024
|
|
20
|
+
| 4 ;
|
|
21
|
+
debugService.onDidEndSession(({ session }) => {
|
|
22
|
+
for (const [fd, memory] of this.fdMemory) {
|
|
23
|
+
if (memory.session === session) {
|
|
24
|
+
this.close(fd);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
watch(resource, opts) {
|
|
30
|
+
if (opts.recursive) {
|
|
31
|
+
return toDisposable(() => { });
|
|
32
|
+
}
|
|
33
|
+
const { session, memoryReference, offset } = this.parseUri(resource);
|
|
34
|
+
const disposable = ( new DisposableStore());
|
|
35
|
+
disposable.add(session.onDidChangeState(() => {
|
|
36
|
+
if (session.state === 3 || session.state === 0 ) {
|
|
37
|
+
this.changeEmitter.fire([{ type: 2 , resource }]);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
disposable.add(session.onDidInvalidateMemory(e => {
|
|
41
|
+
if (e.body.memoryReference !== memoryReference) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (offset && (e.body.offset >= offset.toOffset || e.body.offset + e.body.count < offset.fromOffset)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.changeEmitter.fire([{ resource, type: 0 }]);
|
|
48
|
+
}));
|
|
49
|
+
return disposable;
|
|
50
|
+
}
|
|
51
|
+
stat(file) {
|
|
52
|
+
const { readOnly } = this.parseUri(file);
|
|
53
|
+
return Promise.resolve({
|
|
54
|
+
type: FileType.File,
|
|
55
|
+
mtime: 0,
|
|
56
|
+
ctime: 0,
|
|
57
|
+
size: 0,
|
|
58
|
+
permissions: readOnly ? FilePermission.Readonly : undefined,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
mkdir() {
|
|
62
|
+
throw createFileSystemProviderError(`Not allowed`, FileSystemProviderErrorCode.NoPermissions);
|
|
63
|
+
}
|
|
64
|
+
readdir() {
|
|
65
|
+
throw createFileSystemProviderError(`Not allowed`, FileSystemProviderErrorCode.NoPermissions);
|
|
66
|
+
}
|
|
67
|
+
delete() {
|
|
68
|
+
throw createFileSystemProviderError(`Not allowed`, FileSystemProviderErrorCode.NoPermissions);
|
|
69
|
+
}
|
|
70
|
+
rename() {
|
|
71
|
+
throw createFileSystemProviderError(`Not allowed`, FileSystemProviderErrorCode.NoPermissions);
|
|
72
|
+
}
|
|
73
|
+
open(resource, _opts) {
|
|
74
|
+
const { session, memoryReference, offset } = this.parseUri(resource);
|
|
75
|
+
const fd = this.memoryFdCounter++;
|
|
76
|
+
let region = session.getMemory(memoryReference);
|
|
77
|
+
if (offset) {
|
|
78
|
+
region = ( new MemoryRegionView(region, offset));
|
|
79
|
+
}
|
|
80
|
+
this.fdMemory.set(fd, { session, region });
|
|
81
|
+
return Promise.resolve(fd);
|
|
82
|
+
}
|
|
83
|
+
close(fd) {
|
|
84
|
+
this.fdMemory.get(fd)?.region.dispose();
|
|
85
|
+
this.fdMemory.delete(fd);
|
|
86
|
+
return Promise.resolve();
|
|
87
|
+
}
|
|
88
|
+
async writeFile(resource, content) {
|
|
89
|
+
const { offset } = this.parseUri(resource);
|
|
90
|
+
if (!offset) {
|
|
91
|
+
throw createFileSystemProviderError(`Range must be present to read a file`, FileSystemProviderErrorCode.FileNotFound);
|
|
92
|
+
}
|
|
93
|
+
const fd = await this.open(resource, { create: false });
|
|
94
|
+
try {
|
|
95
|
+
await this.write(fd, offset.fromOffset, content, 0, content.length);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
this.close(fd);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async readFile(resource) {
|
|
102
|
+
const { offset } = this.parseUri(resource);
|
|
103
|
+
if (!offset) {
|
|
104
|
+
throw createFileSystemProviderError(`Range must be present to read a file`, FileSystemProviderErrorCode.FileNotFound);
|
|
105
|
+
}
|
|
106
|
+
const data = ( new Uint8Array(offset.toOffset - offset.fromOffset));
|
|
107
|
+
const fd = await this.open(resource, { create: false });
|
|
108
|
+
try {
|
|
109
|
+
await this.read(fd, offset.fromOffset, data, 0, data.length);
|
|
110
|
+
return data;
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
this.close(fd);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async read(fd, pos, data, offset, length) {
|
|
117
|
+
const memory = this.fdMemory.get(fd);
|
|
118
|
+
if (!memory) {
|
|
119
|
+
throw createFileSystemProviderError(`No file with that descriptor open`, FileSystemProviderErrorCode.Unavailable);
|
|
120
|
+
}
|
|
121
|
+
const ranges = await memory.region.read(pos, length);
|
|
122
|
+
let readSoFar = 0;
|
|
123
|
+
for (const range of ranges) {
|
|
124
|
+
switch (range.type) {
|
|
125
|
+
case 1 :
|
|
126
|
+
return readSoFar;
|
|
127
|
+
case 2 :
|
|
128
|
+
if (readSoFar > 0) {
|
|
129
|
+
return readSoFar;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
throw createFileSystemProviderError(range.error, FileSystemProviderErrorCode.Unknown);
|
|
133
|
+
}
|
|
134
|
+
case 0 : {
|
|
135
|
+
const start = Math.max(0, pos - range.offset);
|
|
136
|
+
const toWrite = range.data.slice(start, Math.min(range.data.byteLength, start + (length - readSoFar)));
|
|
137
|
+
data.set(toWrite.buffer, offset + readSoFar);
|
|
138
|
+
readSoFar += toWrite.byteLength;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
default:
|
|
142
|
+
assertNever();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return readSoFar;
|
|
146
|
+
}
|
|
147
|
+
write(fd, pos, data, offset, length) {
|
|
148
|
+
const memory = this.fdMemory.get(fd);
|
|
149
|
+
if (!memory) {
|
|
150
|
+
throw createFileSystemProviderError(`No file with that descriptor open`, FileSystemProviderErrorCode.Unavailable);
|
|
151
|
+
}
|
|
152
|
+
return memory.region.write(pos, VSBuffer.wrap(data).slice(offset, offset + length));
|
|
153
|
+
}
|
|
154
|
+
parseUri(uri) {
|
|
155
|
+
if (uri.scheme !== DEBUG_MEMORY_SCHEME) {
|
|
156
|
+
throw createFileSystemProviderError(`Cannot open file with scheme ${uri.scheme}`, FileSystemProviderErrorCode.FileNotFound);
|
|
157
|
+
}
|
|
158
|
+
const session = this.debugService.getModel().getSession(uri.authority);
|
|
159
|
+
if (!session) {
|
|
160
|
+
throw createFileSystemProviderError(`Debug session not found`, FileSystemProviderErrorCode.FileNotFound);
|
|
161
|
+
}
|
|
162
|
+
let offset;
|
|
163
|
+
const rangeMatch = rangeRe.exec(uri.query);
|
|
164
|
+
if (rangeMatch) {
|
|
165
|
+
offset = { fromOffset: Number(rangeMatch[1]), toOffset: Number(rangeMatch[2]) };
|
|
166
|
+
}
|
|
167
|
+
const [, memoryReference] = uri.path.split('/');
|
|
168
|
+
return {
|
|
169
|
+
session,
|
|
170
|
+
offset,
|
|
171
|
+
readOnly: !session.capabilities.supportsWriteMemoryRequest,
|
|
172
|
+
sessionId: uri.authority,
|
|
173
|
+
memoryReference: decodeURIComponent(memoryReference),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
class MemoryRegionView extends Disposable {
|
|
178
|
+
constructor(parent, range) {
|
|
179
|
+
super();
|
|
180
|
+
this.parent = parent;
|
|
181
|
+
this.range = range;
|
|
182
|
+
this.invalidateEmitter = ( new Emitter());
|
|
183
|
+
this.onDidInvalidate = this.invalidateEmitter.event;
|
|
184
|
+
this.width = this.range.toOffset - this.range.fromOffset;
|
|
185
|
+
this.writable = parent.writable;
|
|
186
|
+
this._register(parent);
|
|
187
|
+
this._register(parent.onDidInvalidate(e => {
|
|
188
|
+
const fromOffset = clamp(e.fromOffset - range.fromOffset, 0, this.width);
|
|
189
|
+
const toOffset = clamp(e.toOffset - range.fromOffset, 0, this.width);
|
|
190
|
+
if (toOffset > fromOffset) {
|
|
191
|
+
this.invalidateEmitter.fire({ fromOffset, toOffset });
|
|
192
|
+
}
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
read(fromOffset, toOffset) {
|
|
196
|
+
if (fromOffset < 0) {
|
|
197
|
+
throw new RangeError(`Invalid fromOffset: ${fromOffset}`);
|
|
198
|
+
}
|
|
199
|
+
return this.parent.read(this.range.fromOffset + fromOffset, this.range.fromOffset + Math.min(toOffset, this.width));
|
|
200
|
+
}
|
|
201
|
+
write(offset, data) {
|
|
202
|
+
return this.parent.write(this.range.fromOffset + offset, data);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { DebugMemoryFileSystemProvider };
|