@codingame/monaco-vscode-testing-service-override 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackWidget.js +481 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.js +20 -30
- package/vscode/src/vs/workbench/contrib/testing/browser/codeCoverageDisplayUtils.js +6 -7
- package/vscode/src/vs/workbench/contrib/testing/browser/icons.js +32 -33
- package/vscode/src/vs/workbench/contrib/testing/browser/media/testing.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageBars.js +7 -11
- package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageView.js +12 -20
- package/vscode/src/vs/workbench/contrib/testing/browser/testExplorerActions.js +246 -110
- package/vscode/src/vs/workbench/contrib/testing/browser/testResultsView/testMessageStack.js +26 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/testResultsView/testResultsOutput.js +451 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/testResultsView/testResultsSubject.js +88 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/testResultsView/testResultsTree.js +617 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/testResultsView/testResultsViewContent.js +403 -0
- package/vscode/src/vs/workbench/contrib/testing/browser/testing.contribution.js +9 -10
- package/vscode/src/vs/workbench/contrib/testing/browser/testingConfigurationUi.js +4 -5
- package/vscode/src/vs/workbench/contrib/testing/browser/testingDecorations.js +30 -38
- package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.js +12 -13
- package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerView.js +48 -41
- package/vscode/src/vs/workbench/contrib/testing/browser/testingOutputPeek.js +70 -1321
- package/vscode/src/vs/workbench/contrib/testing/browser/testingProgressUiService.js +10 -15
- package/vscode/src/vs/workbench/contrib/testing/browser/testingViewPaneContainer.js +2 -3
- package/vscode/src/vs/workbench/contrib/testing/browser/theme.js +33 -60
- package/vscode/src/vs/workbench/contrib/testing/common/configuration.js +42 -82
- package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +32 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testExclusions.js +1 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +1 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testService.js +46 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testServiceImpl.js +42 -44
- package/vscode/src/vs/workbench/contrib/testing/common/testingContentProvider.js +2 -3
- package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +65 -62
- /package/vscode/src/vs/workbench/contrib/testing/browser/{testingOutputPeek.css.js → testResultsView/testResultsViewContent.css.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-testing-service-override",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@7.1.
|
|
30
|
-
"@codingame/monaco-vscode-terminal-service-override": "7.1.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@7.1.1",
|
|
30
|
+
"@codingame/monaco-vscode-terminal-service-override": "7.1.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { h, addDisposableListener, clearNode } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
4
|
+
import { assertNever } from 'vscode/vscode/vs/base/common/assert';
|
|
5
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
7
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
8
|
+
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import { observableValue } from 'vscode/vscode/vs/base/common/observableInternal/base';
|
|
10
|
+
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
11
|
+
import { autorun, autorunWithStore } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
12
|
+
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
13
|
+
import 'vscode/vscode/vs/base/common/arrays';
|
|
14
|
+
import { Constants } from 'vscode/vscode/vs/base/common/uint';
|
|
15
|
+
import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
|
|
16
|
+
import './media/callStackWidget.css.js';
|
|
17
|
+
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
18
|
+
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
19
|
+
import { EmbeddedCodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
|
|
20
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
21
|
+
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
22
|
+
import { localize, localize2 } from 'vscode/vscode/vs/nls';
|
|
23
|
+
import { createActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
24
|
+
import { MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
25
|
+
import { MenuId, registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
26
|
+
import { TextEditorSelectionRevealType } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
27
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
29
|
+
import { WorkbenchList } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
30
|
+
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
31
|
+
import { defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
32
|
+
import { ResourceLabel } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
33
|
+
import { makeStackFrameColumnDecoration, TOP_STACK_FRAME_DECORATION } from 'vscode/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution';
|
|
34
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
35
|
+
|
|
36
|
+
var FrameCodeRenderer_1, SkippedRenderer_1;
|
|
37
|
+
class CallStackFrame {
|
|
38
|
+
constructor(name, source, line = 1, column = 1) {
|
|
39
|
+
this.name = name;
|
|
40
|
+
this.source = source;
|
|
41
|
+
this.line = line;
|
|
42
|
+
this.column = column;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class SkippedCallFrames {
|
|
46
|
+
constructor(label, load) {
|
|
47
|
+
this.label = label;
|
|
48
|
+
this.load = load;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class CustomStackFrame {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.showHeader = observableValue('CustomStackFrame.showHeader', true);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class WrappedCallStackFrame extends CallStackFrame {
|
|
57
|
+
constructor(original) {
|
|
58
|
+
super(original.name, original.source, original.line, original.column);
|
|
59
|
+
this.editorHeight = observableValue('WrappedCallStackFrame.height', 100);
|
|
60
|
+
this.collapsed = observableValue('WrappedCallStackFrame.collapsed', false);
|
|
61
|
+
this.height = derived(reader => {
|
|
62
|
+
return this.collapsed.read(reader) ? HEADER_HEIGHT : HEADER_HEIGHT + this.editorHeight.read(reader);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class WrappedCustomStackFrame {
|
|
67
|
+
constructor(original) {
|
|
68
|
+
this.original = original;
|
|
69
|
+
this.collapsed = observableValue('WrappedCallStackFrame.collapsed', false);
|
|
70
|
+
this.height = derived(reader => {
|
|
71
|
+
const headerHeight = this.original.showHeader.read(reader) ? HEADER_HEIGHT : 0;
|
|
72
|
+
return this.collapsed.read(reader) ? headerHeight : headerHeight + this.original.height.read(reader);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const WIDGET_CLASS_NAME = 'multiCallStackWidget';
|
|
77
|
+
let CallStackWidget = class CallStackWidget extends Disposable {
|
|
78
|
+
constructor(container, containingEditor, instantiationService) {
|
|
79
|
+
super();
|
|
80
|
+
this.layoutEmitter = this._register(( (new Emitter())));
|
|
81
|
+
this.currentFramesDs = this._register(( (new DisposableStore())));
|
|
82
|
+
container.classList.add(WIDGET_CLASS_NAME);
|
|
83
|
+
this._register(toDisposable(() => container.classList.remove(WIDGET_CLASS_NAME)));
|
|
84
|
+
this.list = this._register(instantiationService.createInstance(WorkbenchList, 'TestResultStackWidget', container, ( (new StackDelegate())), [
|
|
85
|
+
instantiationService.createInstance(FrameCodeRenderer, containingEditor, this.layoutEmitter.event),
|
|
86
|
+
instantiationService.createInstance(MissingCodeRenderer),
|
|
87
|
+
instantiationService.createInstance(CustomRenderer),
|
|
88
|
+
instantiationService.createInstance(SkippedRenderer, (i) => this.loadFrame(i)),
|
|
89
|
+
], {
|
|
90
|
+
multipleSelectionSupport: false,
|
|
91
|
+
mouseSupport: false,
|
|
92
|
+
keyboardSupport: false,
|
|
93
|
+
accessibilityProvider: instantiationService.createInstance(StackAccessibilityProvider),
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
setFrames(frames) {
|
|
97
|
+
this.currentFramesDs.clear();
|
|
98
|
+
this.cts = ( (new CancellationTokenSource()));
|
|
99
|
+
this._register(toDisposable(() => this.cts.dispose(true)));
|
|
100
|
+
this.list.splice(0, this.list.length, this.mapFrames(frames));
|
|
101
|
+
}
|
|
102
|
+
layout(height, width) {
|
|
103
|
+
this.list.layout(height, width);
|
|
104
|
+
this.layoutEmitter.fire();
|
|
105
|
+
}
|
|
106
|
+
async loadFrame(replacing) {
|
|
107
|
+
if (!this.cts) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const frames = await replacing.load(this.cts.token);
|
|
111
|
+
if (this.cts.token.isCancellationRequested) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const index = this.list.indexOf(replacing);
|
|
115
|
+
this.list.splice(index, 1, this.mapFrames(frames));
|
|
116
|
+
}
|
|
117
|
+
mapFrames(frames) {
|
|
118
|
+
const result = [];
|
|
119
|
+
for (const frame of frames) {
|
|
120
|
+
if (frame instanceof SkippedCallFrames) {
|
|
121
|
+
result.push(frame);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const wrapped = frame instanceof CustomStackFrame
|
|
125
|
+
? ( (new WrappedCustomStackFrame(frame))) : ( (new WrappedCallStackFrame(frame)));
|
|
126
|
+
result.push(wrapped);
|
|
127
|
+
this.currentFramesDs.add(autorun(reader => {
|
|
128
|
+
const height = wrapped.height.read(reader);
|
|
129
|
+
const idx = this.list.indexOf(wrapped);
|
|
130
|
+
if (idx !== -1) {
|
|
131
|
+
this.list.updateElementHeight(idx, height);
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
CallStackWidget = ( (__decorate([
|
|
139
|
+
( (__param(2, IInstantiationService)))
|
|
140
|
+
], CallStackWidget)));
|
|
141
|
+
let StackAccessibilityProvider = class StackAccessibilityProvider {
|
|
142
|
+
constructor(labelService) {
|
|
143
|
+
this.labelService = labelService;
|
|
144
|
+
}
|
|
145
|
+
getAriaLabel(e) {
|
|
146
|
+
if (e instanceof SkippedCallFrames) {
|
|
147
|
+
return e.label;
|
|
148
|
+
}
|
|
149
|
+
if (e instanceof WrappedCustomStackFrame) {
|
|
150
|
+
return e.original.label;
|
|
151
|
+
}
|
|
152
|
+
if (e instanceof CallStackFrame) {
|
|
153
|
+
if (e.source && e.line) {
|
|
154
|
+
return ( localize(
|
|
155
|
+
10726,
|
|
156
|
+
'{0}, line {1} in {2}',
|
|
157
|
+
e.name,
|
|
158
|
+
e.line,
|
|
159
|
+
this.labelService.getUriLabel(e.source, { relative: true })
|
|
160
|
+
));
|
|
161
|
+
}
|
|
162
|
+
return e.name;
|
|
163
|
+
}
|
|
164
|
+
assertNever();
|
|
165
|
+
}
|
|
166
|
+
getWidgetAriaLabel() {
|
|
167
|
+
return ( localize(10727, 'Stack Trace'));
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
StackAccessibilityProvider = ( (__decorate([
|
|
171
|
+
( (__param(0, ILabelService)))
|
|
172
|
+
], StackAccessibilityProvider)));
|
|
173
|
+
class StackDelegate {
|
|
174
|
+
getHeight(element) {
|
|
175
|
+
if (element instanceof CallStackFrame || element instanceof WrappedCustomStackFrame) {
|
|
176
|
+
return element.height.get();
|
|
177
|
+
}
|
|
178
|
+
if (element instanceof SkippedCallFrames) {
|
|
179
|
+
return 50;
|
|
180
|
+
}
|
|
181
|
+
assertNever();
|
|
182
|
+
}
|
|
183
|
+
getTemplateId(element) {
|
|
184
|
+
if (element instanceof CallStackFrame) {
|
|
185
|
+
return element.source ? FrameCodeRenderer.templateId : MissingCodeRenderer.templateId;
|
|
186
|
+
}
|
|
187
|
+
if (element instanceof SkippedCallFrames) {
|
|
188
|
+
return SkippedRenderer.templateId;
|
|
189
|
+
}
|
|
190
|
+
if (element instanceof WrappedCustomStackFrame) {
|
|
191
|
+
return CustomRenderer.templateId;
|
|
192
|
+
}
|
|
193
|
+
assertNever();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const editorOptions = {
|
|
197
|
+
scrollBeyondLastLine: false,
|
|
198
|
+
scrollbar: {
|
|
199
|
+
vertical: 'hidden',
|
|
200
|
+
horizontal: 'hidden',
|
|
201
|
+
handleMouseWheel: false,
|
|
202
|
+
useShadows: false,
|
|
203
|
+
},
|
|
204
|
+
overviewRulerLanes: 0,
|
|
205
|
+
fixedOverflowWidgets: true,
|
|
206
|
+
overviewRulerBorder: false,
|
|
207
|
+
stickyScroll: { enabled: false },
|
|
208
|
+
minimap: { enabled: false },
|
|
209
|
+
readOnly: true,
|
|
210
|
+
automaticLayout: false,
|
|
211
|
+
};
|
|
212
|
+
const makeFrameElements = () => h('div.multiCallStackFrame', [
|
|
213
|
+
h('div.header@header', [
|
|
214
|
+
h('div.collapse-button@collapseButton'),
|
|
215
|
+
h('div.title.show-file-icons@title'),
|
|
216
|
+
h('div.actions@actions'),
|
|
217
|
+
]),
|
|
218
|
+
h('div.editorParent', [
|
|
219
|
+
h('div.editorContainer@editor'),
|
|
220
|
+
])
|
|
221
|
+
]);
|
|
222
|
+
const HEADER_HEIGHT = 32;
|
|
223
|
+
let AbstractFrameRenderer = class AbstractFrameRenderer {
|
|
224
|
+
constructor(instantiationService) {
|
|
225
|
+
this.instantiationService = instantiationService;
|
|
226
|
+
}
|
|
227
|
+
renderTemplate(container) {
|
|
228
|
+
const elements = makeFrameElements();
|
|
229
|
+
container.appendChild(elements.root);
|
|
230
|
+
const templateStore = ( (new DisposableStore()));
|
|
231
|
+
container.classList.add('multiCallStackFrameContainer');
|
|
232
|
+
templateStore.add(toDisposable(() => {
|
|
233
|
+
container.classList.remove('multiCallStackFrameContainer');
|
|
234
|
+
elements.root.remove();
|
|
235
|
+
}));
|
|
236
|
+
const label = templateStore.add(this.instantiationService.createInstance(ResourceLabel, elements.title, {}));
|
|
237
|
+
const collapse = templateStore.add(( (new Button(elements.collapseButton, {}))));
|
|
238
|
+
const contentId = generateUuid();
|
|
239
|
+
elements.editor.id = contentId;
|
|
240
|
+
elements.editor.role = 'region';
|
|
241
|
+
elements.collapseButton.setAttribute('aria-controls', contentId);
|
|
242
|
+
return this.finishRenderTemplate({
|
|
243
|
+
container,
|
|
244
|
+
decorations: [],
|
|
245
|
+
elements,
|
|
246
|
+
label,
|
|
247
|
+
collapse,
|
|
248
|
+
elementStore: templateStore.add(( (new DisposableStore()))),
|
|
249
|
+
templateStore,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
renderElement(element, index, template, height) {
|
|
253
|
+
const { elementStore } = template;
|
|
254
|
+
elementStore.clear();
|
|
255
|
+
const item = element;
|
|
256
|
+
this.setupCollapseButton(item, template);
|
|
257
|
+
}
|
|
258
|
+
setupCollapseButton(item, { elementStore, elements, collapse }) {
|
|
259
|
+
elementStore.add(autorun(reader => {
|
|
260
|
+
collapse.element.className = '';
|
|
261
|
+
const collapsed = item.collapsed.read(reader);
|
|
262
|
+
collapse.icon = collapsed ? Codicon.chevronRight : Codicon.chevronDown;
|
|
263
|
+
collapse.element.ariaExpanded = String(!collapsed);
|
|
264
|
+
elements.root.classList.toggle('collapsed', collapsed);
|
|
265
|
+
}));
|
|
266
|
+
elementStore.add(collapse.onDidClick(() => {
|
|
267
|
+
item.collapsed.set(!item.collapsed.get(), undefined);
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
disposeElement(element, index, templateData, height) {
|
|
271
|
+
templateData.elementStore.clear();
|
|
272
|
+
}
|
|
273
|
+
disposeTemplate(templateData) {
|
|
274
|
+
templateData.templateStore.dispose();
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
AbstractFrameRenderer = ( (__decorate([
|
|
278
|
+
( (__param(0, IInstantiationService)))
|
|
279
|
+
], AbstractFrameRenderer)));
|
|
280
|
+
const CONTEXT_LINES = 2;
|
|
281
|
+
let FrameCodeRenderer = class FrameCodeRenderer extends AbstractFrameRenderer {
|
|
282
|
+
static { FrameCodeRenderer_1 = this; }
|
|
283
|
+
static { this.templateId = 'f'; }
|
|
284
|
+
constructor(containingEditor, onLayout, modelService, editorService, instantiationService) {
|
|
285
|
+
super(instantiationService);
|
|
286
|
+
this.containingEditor = containingEditor;
|
|
287
|
+
this.onLayout = onLayout;
|
|
288
|
+
this.modelService = modelService;
|
|
289
|
+
this.editorService = editorService;
|
|
290
|
+
this.templateId = FrameCodeRenderer_1.templateId;
|
|
291
|
+
}
|
|
292
|
+
finishRenderTemplate(data) {
|
|
293
|
+
const editor = this.containingEditor
|
|
294
|
+
? this.instantiationService.createInstance(EmbeddedCodeEditorWidget, data.elements.editor, editorOptions, { isSimpleWidget: true }, this.containingEditor)
|
|
295
|
+
: this.instantiationService.createInstance(CodeEditorWidget, data.elements.editor, editorOptions, { isSimpleWidget: true });
|
|
296
|
+
data.templateStore.add(editor);
|
|
297
|
+
const toolbar = data.templateStore.add(this.instantiationService.createInstance(MenuWorkbenchToolBar, data.elements.actions, MenuId.DebugCallStackToolbar, {
|
|
298
|
+
menuOptions: { shouldForwardArgs: true },
|
|
299
|
+
actionViewItemProvider: (action, options) => createActionViewItem(this.instantiationService, action, options),
|
|
300
|
+
}));
|
|
301
|
+
return { ...data, editor, toolbar };
|
|
302
|
+
}
|
|
303
|
+
renderElement(element, index, template, height) {
|
|
304
|
+
super.renderElement(element, index, template, height);
|
|
305
|
+
const { elementStore, editor } = template;
|
|
306
|
+
const item = element;
|
|
307
|
+
const uri = item.source;
|
|
308
|
+
template.label.element.setFile(uri);
|
|
309
|
+
template.elements.title.role = 'link';
|
|
310
|
+
elementStore.add(addDisposableListener(template.elements.title, 'click', e => {
|
|
311
|
+
this.editorService.openCodeEditor({
|
|
312
|
+
resource: uri,
|
|
313
|
+
options: {
|
|
314
|
+
selection: Range.fromPositions({
|
|
315
|
+
column: item.column ?? 1,
|
|
316
|
+
lineNumber: item.line ?? 1,
|
|
317
|
+
}),
|
|
318
|
+
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport,
|
|
319
|
+
},
|
|
320
|
+
}, this.containingEditor || null, e.ctrlKey || e.metaKey);
|
|
321
|
+
}));
|
|
322
|
+
const cts = ( (new CancellationTokenSource()));
|
|
323
|
+
elementStore.add(toDisposable(() => cts.dispose(true)));
|
|
324
|
+
this.modelService.createModelReference(uri).then(reference => {
|
|
325
|
+
if (cts.token.isCancellationRequested) {
|
|
326
|
+
return reference.dispose();
|
|
327
|
+
}
|
|
328
|
+
elementStore.add(reference);
|
|
329
|
+
editor.setModel(reference.object.textEditorModel);
|
|
330
|
+
this.setupEditorAfterModel(item, template);
|
|
331
|
+
this.setupEditorLayout(item, template);
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
setupEditorLayout(item, { elementStore, container, editor }) {
|
|
335
|
+
const layout = () => {
|
|
336
|
+
const prev = editor.getContentHeight();
|
|
337
|
+
editor.layout({ width: container.clientWidth, height: prev });
|
|
338
|
+
const next = editor.getContentHeight();
|
|
339
|
+
if (next !== prev) {
|
|
340
|
+
editor.layout({ width: container.clientWidth, height: next });
|
|
341
|
+
item.editorHeight.set(next, undefined);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
elementStore.add(this.onLayout(layout));
|
|
345
|
+
layout();
|
|
346
|
+
}
|
|
347
|
+
setupEditorAfterModel(item, template) {
|
|
348
|
+
const range = Range.fromPositions({
|
|
349
|
+
column: item.column ?? 1,
|
|
350
|
+
lineNumber: item.line ?? 1,
|
|
351
|
+
});
|
|
352
|
+
template.toolbar.context = { uri: item.source, range };
|
|
353
|
+
template.editor.setHiddenAreas([
|
|
354
|
+
Range.fromPositions({ column: 1, lineNumber: 1 }, { column: 1, lineNumber: Math.max(1, item.line - CONTEXT_LINES - 1) }),
|
|
355
|
+
Range.fromPositions({ column: 1, lineNumber: item.line + CONTEXT_LINES + 1 }, { column: 1, lineNumber: Constants.MAX_SAFE_SMALL_INTEGER }),
|
|
356
|
+
]);
|
|
357
|
+
template.editor.changeDecorations(accessor => {
|
|
358
|
+
for (const d of template.decorations) {
|
|
359
|
+
accessor.removeDecoration(d);
|
|
360
|
+
}
|
|
361
|
+
template.decorations.length = 0;
|
|
362
|
+
const beforeRange = range.setStartPosition(range.startLineNumber, 1);
|
|
363
|
+
const hasCharactersBefore = !!template.editor.getModel()?.getValueInRange(beforeRange).trim();
|
|
364
|
+
const decoRange = range.setEndPosition(range.startLineNumber, Constants.MAX_SAFE_SMALL_INTEGER);
|
|
365
|
+
template.decorations.push(accessor.addDecoration(decoRange, makeStackFrameColumnDecoration(!hasCharactersBefore)));
|
|
366
|
+
template.decorations.push(accessor.addDecoration(decoRange, TOP_STACK_FRAME_DECORATION));
|
|
367
|
+
});
|
|
368
|
+
item.editorHeight.set(template.editor.getContentHeight(), undefined);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
FrameCodeRenderer = FrameCodeRenderer_1 = ( (__decorate([
|
|
372
|
+
( (__param(2, ITextModelService))),
|
|
373
|
+
( (__param(3, ICodeEditorService))),
|
|
374
|
+
( (__param(4, IInstantiationService)))
|
|
375
|
+
], FrameCodeRenderer)));
|
|
376
|
+
class MissingCodeRenderer {
|
|
377
|
+
constructor() {
|
|
378
|
+
this.templateId = MissingCodeRenderer.templateId;
|
|
379
|
+
}
|
|
380
|
+
static { this.templateId = 'm'; }
|
|
381
|
+
renderTemplate(container) {
|
|
382
|
+
return { container };
|
|
383
|
+
}
|
|
384
|
+
renderElement(element, index, templateData, height) {
|
|
385
|
+
templateData.container.innerText = element.name;
|
|
386
|
+
}
|
|
387
|
+
disposeTemplate(templateData) {
|
|
388
|
+
clearNode(templateData.container);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
class CustomRenderer extends AbstractFrameRenderer {
|
|
392
|
+
constructor() {
|
|
393
|
+
super(...arguments);
|
|
394
|
+
this.templateId = CustomRenderer.templateId;
|
|
395
|
+
}
|
|
396
|
+
static { this.templateId = 'c'; }
|
|
397
|
+
finishRenderTemplate(data) {
|
|
398
|
+
return data;
|
|
399
|
+
}
|
|
400
|
+
renderElement(element, index, template, height) {
|
|
401
|
+
super.renderElement(element, index, template, height);
|
|
402
|
+
const item = element;
|
|
403
|
+
const { elementStore, container, label } = template;
|
|
404
|
+
label.element.setResource({ name: item.original.label }, { icon: item.original.icon });
|
|
405
|
+
elementStore.add(autorun(reader => {
|
|
406
|
+
template.elements.header.style.display = item.original.showHeader.read(reader) ? '' : 'none';
|
|
407
|
+
}));
|
|
408
|
+
elementStore.add(autorunWithStore((reader, store) => {
|
|
409
|
+
if (!item.collapsed.read(reader)) {
|
|
410
|
+
store.add(item.original.render(container));
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
const actions = item.original.renderActions?.(template.elements.actions);
|
|
414
|
+
if (actions) {
|
|
415
|
+
elementStore.add(actions);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
let SkippedRenderer = class SkippedRenderer {
|
|
420
|
+
static { SkippedRenderer_1 = this; }
|
|
421
|
+
static { this.templateId = 's'; }
|
|
422
|
+
constructor(loadFrames, notificationService) {
|
|
423
|
+
this.loadFrames = loadFrames;
|
|
424
|
+
this.notificationService = notificationService;
|
|
425
|
+
this.templateId = SkippedRenderer_1.templateId;
|
|
426
|
+
}
|
|
427
|
+
renderTemplate(container) {
|
|
428
|
+
const store = ( (new DisposableStore()));
|
|
429
|
+
const button = ( (new Button(container, { title: '', ...defaultButtonStyles })));
|
|
430
|
+
const data = { button, store };
|
|
431
|
+
store.add(button);
|
|
432
|
+
store.add(button.onDidClick(() => {
|
|
433
|
+
if (!data.current || !button.enabled) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
button.enabled = false;
|
|
437
|
+
this.loadFrames(data.current).catch(e => {
|
|
438
|
+
this.notificationService.error(( localize(10728, 'Failed to load stack frames: {0}', e.message)));
|
|
439
|
+
});
|
|
440
|
+
}));
|
|
441
|
+
return data;
|
|
442
|
+
}
|
|
443
|
+
renderElement(element, index, templateData, height) {
|
|
444
|
+
const cast = element;
|
|
445
|
+
templateData.button.enabled = true;
|
|
446
|
+
templateData.button.label = cast.label;
|
|
447
|
+
templateData.current = cast;
|
|
448
|
+
}
|
|
449
|
+
disposeTemplate(templateData) {
|
|
450
|
+
templateData.store.dispose();
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
SkippedRenderer = SkippedRenderer_1 = ( (__decorate([
|
|
454
|
+
( (__param(1, INotificationService)))
|
|
455
|
+
], SkippedRenderer)));
|
|
456
|
+
registerAction2(class extends Action2 {
|
|
457
|
+
constructor() {
|
|
458
|
+
super({
|
|
459
|
+
id: 'callStackWidget.goToFile',
|
|
460
|
+
title: ( localize2(10729, 'Open File')),
|
|
461
|
+
icon: Codicon.goToFile,
|
|
462
|
+
menu: {
|
|
463
|
+
id: MenuId.DebugCallStackToolbar,
|
|
464
|
+
order: 22,
|
|
465
|
+
group: 'navigation',
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
async run(accessor, { uri, range }) {
|
|
470
|
+
const editorService = accessor.get(IEditorService);
|
|
471
|
+
await editorService.openEditor({
|
|
472
|
+
resource: uri,
|
|
473
|
+
options: {
|
|
474
|
+
selection: range,
|
|
475
|
+
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
export { CallStackFrame, CallStackWidget, CustomStackFrame, SkippedCallFrames };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".multiCallStackFrame{.header{align-items:center;background:var(--vscode-multiDiffEditor-headerBackground);border-top:1px solid var(--vscode-multiDiffEditor-border);color:var(--vscode-foreground);display:flex;height:32px;padding:0 5px}.title{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&[role=link]{cursor:pointer}}&.collapsed{.header{border-bottom:1px solid var(--vscode-multiDiffEditor-border)}.editorParent{display:none}}.collapse-button{cursor:pointer}.actions{align-items:center;display:flex;gap:8px;margin-right:12px}}.multiCallStackWidget{.multiCallStackFrameContainer{background:none!important}}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -24,7 +24,7 @@ import { EditorOption } from 'vscode/vscode/vs/editor/common/config/editorOption
|
|
|
24
24
|
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
25
25
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
26
26
|
import { InjectedTextCursorStops } from 'vscode/vscode/vs/editor/common/model';
|
|
27
|
-
import {
|
|
27
|
+
import { localize, localize2 } from 'vscode/vscode/vs/nls';
|
|
28
28
|
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
29
29
|
import { MenuId, registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
30
30
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
@@ -49,10 +49,9 @@ import { ITestService } from 'vscode/vscode/vs/workbench/contrib/testing/common/
|
|
|
49
49
|
import { DetailType } from 'vscode/vscode/vs/workbench/contrib/testing/common/testTypes';
|
|
50
50
|
import { TestingContextKeys } from '../common/testingContextKeys.js';
|
|
51
51
|
|
|
52
|
-
const _moduleId = "vs/workbench/contrib/testing/browser/codeCoverageDecorations";
|
|
53
52
|
const CLASS_HIT = 'coverage-deco-hit';
|
|
54
53
|
const CLASS_MISS = 'coverage-deco-miss';
|
|
55
|
-
const TOGGLE_INLINE_COMMAND_TEXT = (
|
|
54
|
+
const TOGGLE_INLINE_COMMAND_TEXT = ( localize(8162, 'Toggle Inline'));
|
|
56
55
|
const TOGGLE_INLINE_COMMAND_ID = 'testing.toggleInlineCoverage';
|
|
57
56
|
const BRANCH_MISS_INDICATOR_CHARS = 4;
|
|
58
57
|
let CodeCoverageDecorations = class CodeCoverageDecorations extends Disposable {
|
|
@@ -404,9 +403,8 @@ class CoverageDetailsModel {
|
|
|
404
403
|
const text = wrapName(model.getValueInRange(tidyLocation(detail.location)).trim() || `<empty statement>`);
|
|
405
404
|
if (detail.branches?.length) {
|
|
406
405
|
const covered = detail.branches.filter(b => !!b.count).length;
|
|
407
|
-
return ( (new MarkdownString())).appendMarkdown((
|
|
408
|
-
|
|
409
|
-
1,
|
|
406
|
+
return ( (new MarkdownString())).appendMarkdown(( localize(
|
|
407
|
+
8163,
|
|
410
408
|
'{0} of {1} of branches in {2} were covered.',
|
|
411
409
|
covered,
|
|
412
410
|
detail.branches.length,
|
|
@@ -422,20 +420,13 @@ class CoverageDetailsModel {
|
|
|
422
420
|
const { count, label } = detail.detail.branches[detail.branch];
|
|
423
421
|
const label2 = label ? wrapInBackticks(label) : `#${detail.branch + 1}`;
|
|
424
422
|
if (!count) {
|
|
425
|
-
return ( (new MarkdownString())).appendMarkdown((
|
|
423
|
+
return ( (new MarkdownString())).appendMarkdown(( localize(8164, 'Branch {0} in {1} was not covered.', label2, text)));
|
|
426
424
|
}
|
|
427
425
|
else if (count === true) {
|
|
428
|
-
return ( (new MarkdownString())).appendMarkdown((
|
|
426
|
+
return ( (new MarkdownString())).appendMarkdown(( localize(8165, 'Branch {0} in {1} was executed.', label2, text)));
|
|
429
427
|
}
|
|
430
428
|
else {
|
|
431
|
-
return ( (new MarkdownString())).appendMarkdown((
|
|
432
|
-
_moduleId,
|
|
433
|
-
4,
|
|
434
|
-
'Branch {0} in {1} was executed {2} time(s).',
|
|
435
|
-
label2,
|
|
436
|
-
text,
|
|
437
|
-
count
|
|
438
|
-
)));
|
|
429
|
+
return ( (new MarkdownString())).appendMarkdown(( localize(8166, 'Branch {0} in {1} was executed {2} time(s).', label2, text, count)));
|
|
439
430
|
}
|
|
440
431
|
}
|
|
441
432
|
assertNever();
|
|
@@ -443,10 +434,10 @@ class CoverageDetailsModel {
|
|
|
443
434
|
}
|
|
444
435
|
function namedDetailLabel(name, detail) {
|
|
445
436
|
return ( (new MarkdownString())).appendMarkdown(!detail.count
|
|
446
|
-
? (
|
|
437
|
+
? ( localize(8167, '`{0}` was not executed.', name))
|
|
447
438
|
: typeof detail.count === 'number'
|
|
448
|
-
? (
|
|
449
|
-
: (
|
|
439
|
+
? ( localize(8168, '`{0}` was executed {1} time(s).', name, detail.count))
|
|
440
|
+
: ( localize(8169, '`{0}` was executed.', name)));
|
|
450
441
|
}
|
|
451
442
|
function tidyLocation(location) {
|
|
452
443
|
if (location instanceof Position) {
|
|
@@ -543,8 +534,8 @@ let CoverageToolbarWidget = class CoverageToolbarWidget extends Disposable {
|
|
|
543
534
|
return;
|
|
544
535
|
}
|
|
545
536
|
const toggleAction = ( (new ActionWithIcon('toggleInline', this.coverage.showInline.get()
|
|
546
|
-
? (
|
|
547
|
-
: (
|
|
537
|
+
? ( localize(8170, 'Hide Inline Coverage'))
|
|
538
|
+
: ( localize(8171, 'Show Inline Coverage')), testingCoverageReport, undefined, () => this.coverage.showInline.set(!this.coverage.showInline.get(), undefined))));
|
|
548
539
|
const kb = this.keybindingService.lookupKeybinding(TOGGLE_INLINE_COMMAND_ID);
|
|
549
540
|
if (kb) {
|
|
550
541
|
toggleAction.tooltip = `${TOGGLE_INLINE_COMMAND_TEXT} (${kb.getLabel()})`;
|
|
@@ -562,14 +553,13 @@ let CoverageToolbarWidget = class CoverageToolbarWidget extends Disposable {
|
|
|
562
553
|
))));
|
|
563
554
|
}
|
|
564
555
|
else if (current.coverage.perTestData?.size) {
|
|
565
|
-
this.actionBar.push(( (new ActionWithIcon('perTestFilter', (
|
|
566
|
-
|
|
567
|
-
10,
|
|
556
|
+
this.actionBar.push(( (new ActionWithIcon('perTestFilter', ( localize(
|
|
557
|
+
8172,
|
|
568
558
|
"{0} test(s) ran code in this file",
|
|
569
559
|
current.coverage.perTestData.size
|
|
570
560
|
)), testingFilterIcon, undefined, () => this.commandService.executeCommand(TestCommandId.CoverageFilterToTestInEditor, this.current, this.editor)))));
|
|
571
561
|
}
|
|
572
|
-
this.actionBar.push(( (new ActionWithIcon('rerun', (
|
|
562
|
+
this.actionBar.push(( (new ActionWithIcon('rerun', ( localize(8173, 'Rerun')), testingRerunIcon, !this.isRunning, () => this.rerunTest()))));
|
|
573
563
|
}
|
|
574
564
|
show() {
|
|
575
565
|
if (this.registered) {
|
|
@@ -629,7 +619,7 @@ registerAction2(class ToggleInlineCoverage extends Action2 {
|
|
|
629
619
|
constructor() {
|
|
630
620
|
super({
|
|
631
621
|
id: TOGGLE_INLINE_COMMAND_ID,
|
|
632
|
-
title: (
|
|
622
|
+
title: ( localize2(8174, "Toggle Inline Coverage")),
|
|
633
623
|
category: Categories.Test,
|
|
634
624
|
keybinding: {
|
|
635
625
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
@@ -637,7 +627,7 @@ registerAction2(class ToggleInlineCoverage extends Action2 {
|
|
|
637
627
|
},
|
|
638
628
|
toggled: {
|
|
639
629
|
condition: TestingContextKeys.inlineCoverageEnabled,
|
|
640
|
-
title: (
|
|
630
|
+
title: ( localize(8175, "Hide Inline Coverage")),
|
|
641
631
|
},
|
|
642
632
|
icon: testingCoverageReport,
|
|
643
633
|
menu: [
|
|
@@ -658,9 +648,9 @@ registerAction2(class ToggleCoverageToolbar extends Action2 {
|
|
|
658
648
|
constructor() {
|
|
659
649
|
super({
|
|
660
650
|
id: TestCommandId.CoverageToggleToolbar,
|
|
661
|
-
title: (
|
|
651
|
+
title: ( localize2(8176, "Test Coverage Toolbar")),
|
|
662
652
|
metadata: {
|
|
663
|
-
description: (
|
|
653
|
+
description: ( localize2(8177, 'Toggle the sticky coverage bar in the editor.'))
|
|
664
654
|
},
|
|
665
655
|
category: Categories.Test,
|
|
666
656
|
toggled: {
|
|
@@ -683,7 +673,7 @@ registerAction2(class FilterCoverageToTestInEditor extends Action2 {
|
|
|
683
673
|
constructor() {
|
|
684
674
|
super({
|
|
685
675
|
id: TestCommandId.CoverageFilterToTestInEditor,
|
|
686
|
-
title: (
|
|
676
|
+
title: ( localize2(8178, "Filter Coverage to Test")),
|
|
687
677
|
category: Categories.Test,
|
|
688
678
|
icon: Codicon.filter,
|
|
689
679
|
toggled: {
|