@codingame/monaco-vscode-extensions-service-override 1.83.8 → 1.83.9
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/assets/webWorkerExtensionHostIframe.html +123 -0
- package/extensions.d.ts +12 -13
- package/extensions.js +456 -0
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +3 -0
- package/package.json +5 -3
- package/tools/url.js +10 -0
- package/tools.js +5 -0
- package/vscode/src/vs/base/common/console.js +59 -0
- package/vscode/src/vs/base/common/prefixTree.js +131 -0
- package/vscode/src/vs/platform/files/common/watcher.js +71 -0
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
- package/vscode/src/vs/platform/log/browser/log.js +26 -0
- package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +330 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +174 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +52 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +61 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +31 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +107 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +94 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +541 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +578 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +387 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +75 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +249 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +411 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +475 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +280 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +283 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +33 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +947 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +118 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +158 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +341 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +463 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +148 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +412 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +182 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +313 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +273 -0
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHost.api.impl.d.ts +2 -2
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostConfiguration.d.ts +3 -3
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostExtensionService.d.ts +3 -4
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostManagedSockets.d.ts +2 -2
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTerminalService.d.ts +19 -20
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTunnelService.d.ts +7 -8
- package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostWorkspace.d.ts +25 -26
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +217 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +57 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +51 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +92 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +648 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +297 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +62 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +109 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +109 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +331 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +380 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +5 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1196 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +19 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +334 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +543 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +178 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +101 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +57 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +145 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +3 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +73 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +179 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +5 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +482 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +85 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +56 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +110 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +260 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +616 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +309 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +38 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +167 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +80 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +70 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +108 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +506 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +132 -0
- package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +103 -0
- package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +28 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +25 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +336 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +46 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +283 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +273 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1093 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +643 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +220 -0
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +5 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +79 -0
- package/vscode-proposed.d.ts +0 -3872
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHost.protocol.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostExtensionActivator.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostFileSystemInfo.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostInitDataService.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostLocalizationService.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostRpcService.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostStoragePaths.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTypes.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostUriTransformerService.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/api/worker/extHostExtensionService.d.ts +0 -0
- /package/{dist/main/vscode → vscode}/src/vs/workbench/services/search/common/queryBuilder.d.ts +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { ITerminalService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal';
|
|
5
|
+
|
|
6
|
+
let TerminalProcessExtHostProxy = class TerminalProcessExtHostProxy extends Disposable {
|
|
7
|
+
get onProcessReady() { return this._onProcessReady.event; }
|
|
8
|
+
constructor(instanceId, _cols, _rows, _terminalService) {
|
|
9
|
+
super();
|
|
10
|
+
this.instanceId = instanceId;
|
|
11
|
+
this._cols = _cols;
|
|
12
|
+
this._rows = _rows;
|
|
13
|
+
this._terminalService = _terminalService;
|
|
14
|
+
this.id = 0;
|
|
15
|
+
this.shouldPersist = false;
|
|
16
|
+
this._onProcessData = this._register(( new Emitter()));
|
|
17
|
+
this.onProcessData = this._onProcessData.event;
|
|
18
|
+
this._onProcessReady = this._register(( new Emitter()));
|
|
19
|
+
this._onStart = this._register(( new Emitter()));
|
|
20
|
+
this.onStart = this._onStart.event;
|
|
21
|
+
this._onInput = this._register(( new Emitter()));
|
|
22
|
+
this.onInput = this._onInput.event;
|
|
23
|
+
this._onBinary = this._register(( new Emitter()));
|
|
24
|
+
this.onBinary = this._onBinary.event;
|
|
25
|
+
this._onResize = this._register(( new Emitter()));
|
|
26
|
+
this.onResize = this._onResize.event;
|
|
27
|
+
this._onAcknowledgeDataEvent = this._register(( new Emitter()));
|
|
28
|
+
this.onAcknowledgeDataEvent = this._onAcknowledgeDataEvent.event;
|
|
29
|
+
this._onShutdown = this._register(( new Emitter()));
|
|
30
|
+
this.onShutdown = this._onShutdown.event;
|
|
31
|
+
this._onRequestInitialCwd = this._register(( new Emitter()));
|
|
32
|
+
this.onRequestInitialCwd = this._onRequestInitialCwd.event;
|
|
33
|
+
this._onRequestCwd = this._register(( new Emitter()));
|
|
34
|
+
this.onRequestCwd = this._onRequestCwd.event;
|
|
35
|
+
this._onDidChangeProperty = this._register(( new Emitter()));
|
|
36
|
+
this.onDidChangeProperty = this._onDidChangeProperty.event;
|
|
37
|
+
this._onProcessExit = this._register(( new Emitter()));
|
|
38
|
+
this.onProcessExit = this._onProcessExit.event;
|
|
39
|
+
this._pendingInitialCwdRequests = [];
|
|
40
|
+
this._pendingCwdRequests = [];
|
|
41
|
+
}
|
|
42
|
+
emitData(data) {
|
|
43
|
+
this._onProcessData.fire(data);
|
|
44
|
+
}
|
|
45
|
+
emitTitle(title) {
|
|
46
|
+
this._onDidChangeProperty.fire({ type: "title" , value: title });
|
|
47
|
+
}
|
|
48
|
+
emitReady(pid, cwd) {
|
|
49
|
+
this._onProcessReady.fire({ pid, cwd, windowsPty: undefined });
|
|
50
|
+
}
|
|
51
|
+
emitProcessProperty({ type, value }) {
|
|
52
|
+
switch (type) {
|
|
53
|
+
case "cwd" :
|
|
54
|
+
this.emitCwd(value);
|
|
55
|
+
break;
|
|
56
|
+
case "initialCwd" :
|
|
57
|
+
this.emitInitialCwd(value);
|
|
58
|
+
break;
|
|
59
|
+
case "title" :
|
|
60
|
+
this.emitTitle(value);
|
|
61
|
+
break;
|
|
62
|
+
case "overrideDimensions" :
|
|
63
|
+
this.emitOverrideDimensions(value);
|
|
64
|
+
break;
|
|
65
|
+
case "resolvedShellLaunchConfig" :
|
|
66
|
+
this.emitResolvedShellLaunchConfig(value);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
emitExit(exitCode) {
|
|
71
|
+
this._onProcessExit.fire(exitCode);
|
|
72
|
+
this.dispose();
|
|
73
|
+
}
|
|
74
|
+
emitOverrideDimensions(dimensions) {
|
|
75
|
+
this._onDidChangeProperty.fire({ type: "overrideDimensions" , value: dimensions });
|
|
76
|
+
}
|
|
77
|
+
emitResolvedShellLaunchConfig(shellLaunchConfig) {
|
|
78
|
+
this._onDidChangeProperty.fire({ type: "resolvedShellLaunchConfig" , value: shellLaunchConfig });
|
|
79
|
+
}
|
|
80
|
+
emitInitialCwd(initialCwd) {
|
|
81
|
+
while (this._pendingInitialCwdRequests.length > 0) {
|
|
82
|
+
this._pendingInitialCwdRequests.pop()(initialCwd);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
emitCwd(cwd) {
|
|
86
|
+
while (this._pendingCwdRequests.length > 0) {
|
|
87
|
+
this._pendingCwdRequests.pop()(cwd);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async start() {
|
|
91
|
+
return this._terminalService.requestStartExtensionTerminal(this, this._cols, this._rows);
|
|
92
|
+
}
|
|
93
|
+
shutdown(immediate) {
|
|
94
|
+
this._onShutdown.fire(immediate);
|
|
95
|
+
}
|
|
96
|
+
input(data) {
|
|
97
|
+
this._onInput.fire(data);
|
|
98
|
+
}
|
|
99
|
+
resize(cols, rows) {
|
|
100
|
+
this._onResize.fire({ cols, rows });
|
|
101
|
+
}
|
|
102
|
+
clearBuffer() {
|
|
103
|
+
}
|
|
104
|
+
acknowledgeDataEvent() {
|
|
105
|
+
}
|
|
106
|
+
async setUnicodeVersion(version) {
|
|
107
|
+
}
|
|
108
|
+
async processBinary(data) {
|
|
109
|
+
this._onBinary.fire(data);
|
|
110
|
+
}
|
|
111
|
+
getInitialCwd() {
|
|
112
|
+
return ( new Promise(resolve => {
|
|
113
|
+
this._onRequestInitialCwd.fire();
|
|
114
|
+
this._pendingInitialCwdRequests.push(resolve);
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
getCwd() {
|
|
118
|
+
return ( new Promise(resolve => {
|
|
119
|
+
this._onRequestCwd.fire();
|
|
120
|
+
this._pendingCwdRequests.push(resolve);
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
async refreshProperty(type) {
|
|
124
|
+
}
|
|
125
|
+
async updateProperty(type, value) {
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
TerminalProcessExtHostProxy = ( __decorate([
|
|
129
|
+
( __param(3, ITerminalService))
|
|
130
|
+
], TerminalProcessExtHostProxy));
|
|
131
|
+
|
|
132
|
+
export { TerminalProcessExtHostProxy };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
|
|
2
|
+
import { statePriority, makeEmptyCounts, maxPriority } from './testingStates.js';
|
|
3
|
+
|
|
4
|
+
const isDurationAccessor = (accessor) => 'getOwnDuration' in accessor;
|
|
5
|
+
const getComputedState = (accessor, node, force = false) => {
|
|
6
|
+
let computed = accessor.getCurrentComputedState(node);
|
|
7
|
+
if (computed === undefined || force) {
|
|
8
|
+
computed = accessor.getOwnState(node) ?? 0 ;
|
|
9
|
+
let childrenCount = 0;
|
|
10
|
+
const stateMap = makeEmptyCounts();
|
|
11
|
+
for (const child of accessor.getChildren(node)) {
|
|
12
|
+
const childComputed = getComputedState(accessor, child);
|
|
13
|
+
childrenCount++;
|
|
14
|
+
stateMap[childComputed]++;
|
|
15
|
+
computed = childComputed === 5 && computed === 0
|
|
16
|
+
? 5 : maxPriority(computed, childComputed);
|
|
17
|
+
}
|
|
18
|
+
if (childrenCount > LARGE_NODE_THRESHOLD) {
|
|
19
|
+
largeNodeChildrenStates.set(node, stateMap);
|
|
20
|
+
}
|
|
21
|
+
accessor.setComputedState(node, computed);
|
|
22
|
+
}
|
|
23
|
+
return computed;
|
|
24
|
+
};
|
|
25
|
+
const getComputedDuration = (accessor, node, force = false) => {
|
|
26
|
+
let computed = accessor.getCurrentComputedDuration(node);
|
|
27
|
+
if (computed === undefined || force) {
|
|
28
|
+
const own = accessor.getOwnDuration(node);
|
|
29
|
+
if (own !== undefined) {
|
|
30
|
+
computed = own;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
computed = undefined;
|
|
34
|
+
for (const child of accessor.getChildren(node)) {
|
|
35
|
+
const d = getComputedDuration(accessor, child);
|
|
36
|
+
if (d !== undefined) {
|
|
37
|
+
computed = (computed || 0) + d;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
accessor.setComputedDuration(node, computed);
|
|
42
|
+
}
|
|
43
|
+
return computed;
|
|
44
|
+
};
|
|
45
|
+
const LARGE_NODE_THRESHOLD = 64;
|
|
46
|
+
const largeNodeChildrenStates = ( new WeakMap());
|
|
47
|
+
const refreshComputedState = (accessor, node, explicitNewComputedState, refreshDuration = true) => {
|
|
48
|
+
const oldState = accessor.getCurrentComputedState(node);
|
|
49
|
+
const oldPriority = statePriority[oldState];
|
|
50
|
+
const newState = explicitNewComputedState ?? getComputedState(accessor, node, true);
|
|
51
|
+
const newPriority = statePriority[newState];
|
|
52
|
+
const toUpdate = ( new Set());
|
|
53
|
+
if (newPriority !== oldPriority) {
|
|
54
|
+
accessor.setComputedState(node, newState);
|
|
55
|
+
toUpdate.add(node);
|
|
56
|
+
let moveFromState = oldState;
|
|
57
|
+
let moveToState = newState;
|
|
58
|
+
for (const parent of accessor.getParents(node)) {
|
|
59
|
+
const lnm = largeNodeChildrenStates.get(parent);
|
|
60
|
+
if (lnm) {
|
|
61
|
+
lnm[moveFromState]--;
|
|
62
|
+
lnm[moveToState]++;
|
|
63
|
+
}
|
|
64
|
+
const prev = accessor.getCurrentComputedState(parent);
|
|
65
|
+
if (newPriority > oldPriority) {
|
|
66
|
+
if (prev !== undefined && statePriority[prev] >= newPriority) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (lnm && lnm[moveToState] > 1) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
accessor.setComputedState(parent, newState);
|
|
73
|
+
toUpdate.add(parent);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (prev === undefined || statePriority[prev] > oldPriority) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (lnm && lnm[moveFromState] > 0) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
moveToState = getComputedState(accessor, parent, true);
|
|
83
|
+
accessor.setComputedState(parent, moveToState);
|
|
84
|
+
toUpdate.add(parent);
|
|
85
|
+
}
|
|
86
|
+
moveFromState = prev;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (isDurationAccessor(accessor) && refreshDuration) {
|
|
90
|
+
for (const parent of Iterable.concat(Iterable.single(node), accessor.getParents(node))) {
|
|
91
|
+
const oldDuration = accessor.getCurrentComputedDuration(parent);
|
|
92
|
+
const newDuration = getComputedDuration(accessor, parent, true);
|
|
93
|
+
if (oldDuration === newDuration) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
accessor.setComputedDuration(parent, newDuration);
|
|
97
|
+
toUpdate.add(parent);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return toUpdate;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { refreshComputedState };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
2
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
|
|
4
|
+
class MutableObservableValue extends Disposable {
|
|
5
|
+
get value() {
|
|
6
|
+
return this._value;
|
|
7
|
+
}
|
|
8
|
+
set value(v) {
|
|
9
|
+
if (v !== this._value) {
|
|
10
|
+
this._value = v;
|
|
11
|
+
this.changeEmitter.fire(v);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
static stored(stored, defaultValue) {
|
|
15
|
+
const o = ( new MutableObservableValue(stored.get(defaultValue)));
|
|
16
|
+
o._register(stored);
|
|
17
|
+
o._register(o.onDidChange(value => stored.store(value)));
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
constructor(_value) {
|
|
21
|
+
super();
|
|
22
|
+
this._value = _value;
|
|
23
|
+
this.changeEmitter = this._register(( new Emitter()));
|
|
24
|
+
this.onDidChange = this.changeEmitter.event;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { MutableObservableValue };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
2
|
+
|
|
3
|
+
class TestCoverage {
|
|
4
|
+
constructor(accessor) {
|
|
5
|
+
this.accessor = accessor;
|
|
6
|
+
}
|
|
7
|
+
async getAllFiles(token = CancellationToken.None) {
|
|
8
|
+
if (!this.fileCoverage) {
|
|
9
|
+
this.fileCoverage = this.accessor.provideFileCoverage(token);
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
return await this.fileCoverage;
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
this.fileCoverage = undefined;
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async getUri(uri, token = CancellationToken.None) {
|
|
20
|
+
const files = await this.getAllFiles(token);
|
|
21
|
+
return files.find(f => ( f.uri.toString()) === ( uri.toString()));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { TestCoverage };
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { DeferredPromise } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
2
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
3
|
+
import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import { Lazy } from 'monaco-editor/esm/vs/base/common/lazy.js';
|
|
5
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { language } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
7
|
+
import { removeAnsiEscapeCodes } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
8
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
9
|
+
import { refreshComputedState } from './getComputedState.js';
|
|
10
|
+
import { MutableObservableValue } from './observableValue.js';
|
|
11
|
+
import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
|
|
12
|
+
import { makeEmptyCounts, terminalStatePriorities, maxPriority } from './testingStates.js';
|
|
13
|
+
import { TestResultItem, getMarkId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testTypes';
|
|
14
|
+
|
|
15
|
+
({
|
|
16
|
+
buffers: [],
|
|
17
|
+
length: 0,
|
|
18
|
+
onDidWriteData: Event.None,
|
|
19
|
+
endPromise: Promise.resolve(),
|
|
20
|
+
getRange: () => VSBuffer.alloc(0),
|
|
21
|
+
getRangeIter: () => [],
|
|
22
|
+
});
|
|
23
|
+
class TaskRawOutput {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.writeDataEmitter = ( new Emitter());
|
|
26
|
+
this.endDeferred = ( new DeferredPromise());
|
|
27
|
+
this.offset = 0;
|
|
28
|
+
this.onDidWriteData = this.writeDataEmitter.event;
|
|
29
|
+
this.endPromise = this.endDeferred.p;
|
|
30
|
+
this.buffers = [];
|
|
31
|
+
}
|
|
32
|
+
get length() {
|
|
33
|
+
return this.offset;
|
|
34
|
+
}
|
|
35
|
+
getRange(start, length) {
|
|
36
|
+
const buf = VSBuffer.alloc(length);
|
|
37
|
+
let bufLastWrite = 0;
|
|
38
|
+
for (const chunk of this.getRangeIter(start, length)) {
|
|
39
|
+
buf.buffer.set(chunk.buffer, bufLastWrite);
|
|
40
|
+
bufLastWrite += chunk.byteLength;
|
|
41
|
+
}
|
|
42
|
+
return bufLastWrite < length ? buf.slice(0, bufLastWrite) : buf;
|
|
43
|
+
}
|
|
44
|
+
*getRangeIter(start, length) {
|
|
45
|
+
let soFar = 0;
|
|
46
|
+
let internalLastRead = 0;
|
|
47
|
+
for (const b of this.buffers) {
|
|
48
|
+
if (internalLastRead + b.byteLength <= start) {
|
|
49
|
+
internalLastRead += b.byteLength;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const bstart = Math.max(0, start - internalLastRead);
|
|
53
|
+
const bend = Math.min(b.byteLength, bstart + length - soFar);
|
|
54
|
+
yield b.slice(bstart, bend);
|
|
55
|
+
soFar += bend - bstart;
|
|
56
|
+
internalLastRead += b.byteLength;
|
|
57
|
+
if (soFar === length) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
append(data, marker) {
|
|
63
|
+
const offset = this.offset;
|
|
64
|
+
let length = data.byteLength;
|
|
65
|
+
if (marker === undefined) {
|
|
66
|
+
this.push(data);
|
|
67
|
+
return { offset, length };
|
|
68
|
+
}
|
|
69
|
+
const start = VSBuffer.fromString(getMarkCode(marker, true));
|
|
70
|
+
const end = VSBuffer.fromString(getMarkCode(marker, false));
|
|
71
|
+
length += start.byteLength + end.byteLength;
|
|
72
|
+
this.push(start);
|
|
73
|
+
let trimLen = data.byteLength;
|
|
74
|
+
for (; trimLen > 0; trimLen--) {
|
|
75
|
+
const last = data.buffer[trimLen - 1];
|
|
76
|
+
if (last !== 13 && last !== 10 ) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
this.push(data.slice(0, trimLen));
|
|
81
|
+
this.push(end);
|
|
82
|
+
this.push(data.slice(trimLen));
|
|
83
|
+
return { offset, length };
|
|
84
|
+
}
|
|
85
|
+
push(data) {
|
|
86
|
+
if (data.byteLength === 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.buffers.push(data);
|
|
90
|
+
this.writeDataEmitter.fire(data);
|
|
91
|
+
this.offset += data.byteLength;
|
|
92
|
+
}
|
|
93
|
+
end() {
|
|
94
|
+
this.endDeferred.complete();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const getMarkCode = (marker, start) => `\x1b]633;SetMark;Id=${getMarkId(marker, start)};Hidden\x07`;
|
|
98
|
+
const itemToNode = (controllerId, item, parent) => ({
|
|
99
|
+
controllerId,
|
|
100
|
+
expand: 0 ,
|
|
101
|
+
item: { ...item },
|
|
102
|
+
children: [],
|
|
103
|
+
tasks: [],
|
|
104
|
+
ownComputedState: 0 ,
|
|
105
|
+
computedState: 0 ,
|
|
106
|
+
});
|
|
107
|
+
class LiveTestResult extends Disposable {
|
|
108
|
+
get completedAt() {
|
|
109
|
+
return this._completedAt;
|
|
110
|
+
}
|
|
111
|
+
get tests() {
|
|
112
|
+
return ( this.testById.values());
|
|
113
|
+
}
|
|
114
|
+
constructor(id, persist, request) {
|
|
115
|
+
super();
|
|
116
|
+
this.id = id;
|
|
117
|
+
this.persist = persist;
|
|
118
|
+
this.request = request;
|
|
119
|
+
this.completeEmitter = this._register(( new Emitter()));
|
|
120
|
+
this.newTaskEmitter = this._register(( new Emitter()));
|
|
121
|
+
this.endTaskEmitter = this._register(( new Emitter()));
|
|
122
|
+
this.changeEmitter = this._register(( new Emitter()));
|
|
123
|
+
this.testById = ( new Map());
|
|
124
|
+
this.testMarkerCounter = 0;
|
|
125
|
+
this.startedAt = Date.now();
|
|
126
|
+
this.onChange = this.changeEmitter.event;
|
|
127
|
+
this.onComplete = this.completeEmitter.event;
|
|
128
|
+
this.onNewTask = this.newTaskEmitter.event;
|
|
129
|
+
this.onEndTask = this.endTaskEmitter.event;
|
|
130
|
+
this.tasks = [];
|
|
131
|
+
this.name = ( localizeWithPath(
|
|
132
|
+
'vs/workbench/contrib/testing/common/testResult',
|
|
133
|
+
'runFinished',
|
|
134
|
+
'Test run at {0}',
|
|
135
|
+
( new Date()).toLocaleString(language)
|
|
136
|
+
));
|
|
137
|
+
this.counts = makeEmptyCounts();
|
|
138
|
+
this.computedStateAccessor = {
|
|
139
|
+
getOwnState: i => i.ownComputedState,
|
|
140
|
+
getCurrentComputedState: i => i.computedState,
|
|
141
|
+
setComputedState: (i, s) => i.computedState = s,
|
|
142
|
+
getChildren: i => i.children,
|
|
143
|
+
getParents: i => {
|
|
144
|
+
const { testById: testByExtId } = this;
|
|
145
|
+
return (function* () {
|
|
146
|
+
const parentId = TestId.fromString(i.item.extId).parentId;
|
|
147
|
+
if (parentId) {
|
|
148
|
+
for (const id of parentId.idsToRoot()) {
|
|
149
|
+
yield testByExtId.get(( id.toString()));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})();
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
this.doSerialize = ( new Lazy(() => ({
|
|
156
|
+
id: this.id,
|
|
157
|
+
completedAt: this.completedAt,
|
|
158
|
+
tasks: ( this.tasks.map(t => ({ id: t.id, name: t.name }))),
|
|
159
|
+
name: this.name,
|
|
160
|
+
request: this.request,
|
|
161
|
+
items: ( [...( this.testById.values())].map(TestResultItem.serializeWithoutMessages)),
|
|
162
|
+
})));
|
|
163
|
+
this.doSerializeWithMessages = ( new Lazy(() => ({
|
|
164
|
+
id: this.id,
|
|
165
|
+
completedAt: this.completedAt,
|
|
166
|
+
tasks: ( this.tasks.map(t => ({ id: t.id, name: t.name }))),
|
|
167
|
+
name: this.name,
|
|
168
|
+
request: this.request,
|
|
169
|
+
items: ( [...( this.testById.values())].map(TestResultItem.serialize)),
|
|
170
|
+
})));
|
|
171
|
+
}
|
|
172
|
+
getStateById(extTestId) {
|
|
173
|
+
return this.testById.get(extTestId);
|
|
174
|
+
}
|
|
175
|
+
appendOutput(output, taskId, location, testId) {
|
|
176
|
+
const preview = output.byteLength > 100 ? ( output.slice(0, 100).toString()) + '…' : ( output.toString());
|
|
177
|
+
let marker;
|
|
178
|
+
if (testId || location) {
|
|
179
|
+
marker = this.testMarkerCounter++;
|
|
180
|
+
}
|
|
181
|
+
const index = this.mustGetTaskIndex(taskId);
|
|
182
|
+
const task = this.tasks[index];
|
|
183
|
+
const { offset, length } = task.output.append(output, marker);
|
|
184
|
+
const message = {
|
|
185
|
+
location,
|
|
186
|
+
message: removeAnsiEscapeCodes(preview),
|
|
187
|
+
offset,
|
|
188
|
+
length,
|
|
189
|
+
marker,
|
|
190
|
+
type: 1 ,
|
|
191
|
+
};
|
|
192
|
+
const test = testId && this.testById.get(testId);
|
|
193
|
+
if (test) {
|
|
194
|
+
test.tasks[index].messages.push(message);
|
|
195
|
+
this.changeEmitter.fire({ item: test, result: this, reason: 2 , message });
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
task.otherMessages.push(message);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
addTask(task) {
|
|
202
|
+
this.tasks.push({ ...task, coverage: this._register(( new MutableObservableValue(undefined))), otherMessages: [], output: ( new TaskRawOutput()) });
|
|
203
|
+
for (const test of this.tests) {
|
|
204
|
+
test.tasks.push({ duration: undefined, messages: [], state: 0 });
|
|
205
|
+
}
|
|
206
|
+
this.newTaskEmitter.fire(this.tasks.length - 1);
|
|
207
|
+
}
|
|
208
|
+
addTestChainToRun(controllerId, chain) {
|
|
209
|
+
let parent = this.testById.get(chain[0].extId);
|
|
210
|
+
if (!parent) {
|
|
211
|
+
parent = this.addTestToRun(controllerId, chain[0], null);
|
|
212
|
+
}
|
|
213
|
+
for (let i = 1; i < chain.length; i++) {
|
|
214
|
+
parent = this.addTestToRun(controllerId, chain[i], parent.item.extId);
|
|
215
|
+
}
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
updateState(testId, taskId, state, duration) {
|
|
219
|
+
const entry = this.testById.get(testId);
|
|
220
|
+
if (!entry) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const index = this.mustGetTaskIndex(taskId);
|
|
224
|
+
const oldTerminalStatePrio = terminalStatePriorities[entry.tasks[index].state];
|
|
225
|
+
const newTerminalStatePrio = terminalStatePriorities[state];
|
|
226
|
+
if (oldTerminalStatePrio !== undefined &&
|
|
227
|
+
(newTerminalStatePrio === undefined || newTerminalStatePrio < oldTerminalStatePrio)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.fireUpdateAndRefresh(entry, index, state, duration);
|
|
231
|
+
}
|
|
232
|
+
appendMessage(testId, taskId, message) {
|
|
233
|
+
const entry = this.testById.get(testId);
|
|
234
|
+
if (!entry) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
entry.tasks[this.mustGetTaskIndex(taskId)].messages.push(message);
|
|
238
|
+
this.changeEmitter.fire({ item: entry, result: this, reason: 2 , message });
|
|
239
|
+
}
|
|
240
|
+
markTaskComplete(taskId) {
|
|
241
|
+
const index = this.mustGetTaskIndex(taskId);
|
|
242
|
+
const task = this.tasks[index];
|
|
243
|
+
task.running = false;
|
|
244
|
+
task.output.end();
|
|
245
|
+
this.setAllToState(0 , taskId, t => t.state === 1 || t.state === 2 );
|
|
246
|
+
this.endTaskEmitter.fire(index);
|
|
247
|
+
}
|
|
248
|
+
markComplete() {
|
|
249
|
+
if (this._completedAt !== undefined) {
|
|
250
|
+
throw new Error('cannot complete a test result multiple times');
|
|
251
|
+
}
|
|
252
|
+
for (const task of this.tasks) {
|
|
253
|
+
if (task.running) {
|
|
254
|
+
this.markTaskComplete(task.id);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this._completedAt = Date.now();
|
|
258
|
+
this.completeEmitter.fire();
|
|
259
|
+
}
|
|
260
|
+
markRetired(testIds) {
|
|
261
|
+
for (const [id, test] of this.testById) {
|
|
262
|
+
if (!test.retired && (!testIds || testIds.hasKeyOrParent(TestId.fromString(id).path))) {
|
|
263
|
+
test.retired = true;
|
|
264
|
+
this.changeEmitter.fire({ reason: 0 , item: test, result: this });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
toJSON() {
|
|
269
|
+
return this.completedAt && this.persist ? this.doSerialize.value : undefined;
|
|
270
|
+
}
|
|
271
|
+
toJSONWithMessages() {
|
|
272
|
+
return this.completedAt && this.persist ? this.doSerializeWithMessages.value : undefined;
|
|
273
|
+
}
|
|
274
|
+
setAllToState(state, taskId, when) {
|
|
275
|
+
const index = this.mustGetTaskIndex(taskId);
|
|
276
|
+
for (const test of ( this.testById.values())) {
|
|
277
|
+
if (when(test.tasks[index], test)) {
|
|
278
|
+
this.fireUpdateAndRefresh(test, index, state);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
fireUpdateAndRefresh(entry, taskIndex, newState, newOwnDuration) {
|
|
283
|
+
const previousOwnComputed = entry.ownComputedState;
|
|
284
|
+
const previousOwnDuration = entry.ownDuration;
|
|
285
|
+
const changeEvent = {
|
|
286
|
+
item: entry,
|
|
287
|
+
result: this,
|
|
288
|
+
reason: 1 ,
|
|
289
|
+
previousState: previousOwnComputed,
|
|
290
|
+
previousOwnDuration: previousOwnDuration,
|
|
291
|
+
};
|
|
292
|
+
entry.tasks[taskIndex].state = newState;
|
|
293
|
+
if (newOwnDuration !== undefined) {
|
|
294
|
+
entry.tasks[taskIndex].duration = newOwnDuration;
|
|
295
|
+
entry.ownDuration = Math.max(entry.ownDuration || 0, newOwnDuration);
|
|
296
|
+
}
|
|
297
|
+
const newOwnComputed = maxPriority(...( entry.tasks.map(t => t.state)));
|
|
298
|
+
if (newOwnComputed === previousOwnComputed) {
|
|
299
|
+
if (newOwnDuration !== previousOwnDuration) {
|
|
300
|
+
this.changeEmitter.fire(changeEvent);
|
|
301
|
+
}
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
entry.ownComputedState = newOwnComputed;
|
|
305
|
+
this.counts[previousOwnComputed]--;
|
|
306
|
+
this.counts[newOwnComputed]++;
|
|
307
|
+
refreshComputedState(this.computedStateAccessor, entry).forEach(t => this.changeEmitter.fire(t === entry ? changeEvent : {
|
|
308
|
+
item: t,
|
|
309
|
+
result: this,
|
|
310
|
+
reason: 0 ,
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
addTestToRun(controllerId, item, parent) {
|
|
314
|
+
const node = itemToNode(controllerId, item);
|
|
315
|
+
this.testById.set(item.extId, node);
|
|
316
|
+
this.counts[0 ]++;
|
|
317
|
+
if (parent) {
|
|
318
|
+
this.testById.get(parent)?.children.push(node);
|
|
319
|
+
}
|
|
320
|
+
if (this.tasks.length) {
|
|
321
|
+
for (let i = 0; i < this.tasks.length; i++) {
|
|
322
|
+
node.tasks.push({ duration: undefined, messages: [], state: 0 });
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return node;
|
|
326
|
+
}
|
|
327
|
+
mustGetTaskIndex(taskId) {
|
|
328
|
+
const index = this.tasks.findIndex(t => t.id === taskId);
|
|
329
|
+
if (index === -1) {
|
|
330
|
+
throw new Error(`Unknown task ${taskId} in updateState`);
|
|
331
|
+
}
|
|
332
|
+
return index;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export { LiveTestResult, TaskRawOutput };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const statePriority = {
|
|
2
|
+
[2 ]: 6,
|
|
3
|
+
[6 ]: 5,
|
|
4
|
+
[4 ]: 4,
|
|
5
|
+
[1 ]: 3,
|
|
6
|
+
[3 ]: 2,
|
|
7
|
+
[0 ]: 0,
|
|
8
|
+
[5 ]: 1,
|
|
9
|
+
};
|
|
10
|
+
Object.entries(statePriority).reduce((acc, [stateStr, priority]) => {
|
|
11
|
+
const state = Number(stateStr);
|
|
12
|
+
acc[state] = { statusNode: true, state, priority };
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
15
|
+
const cmpPriority = (a, b) => statePriority[b] - statePriority[a];
|
|
16
|
+
const maxPriority = (...states) => {
|
|
17
|
+
switch (states.length) {
|
|
18
|
+
case 0:
|
|
19
|
+
return 0 ;
|
|
20
|
+
case 1:
|
|
21
|
+
return states[0];
|
|
22
|
+
case 2:
|
|
23
|
+
return statePriority[states[0]] > statePriority[states[1]] ? states[0] : states[1];
|
|
24
|
+
default: {
|
|
25
|
+
let max = states[0];
|
|
26
|
+
for (let i = 1; i < states.length; i++) {
|
|
27
|
+
if (statePriority[max] < statePriority[states[i]]) {
|
|
28
|
+
max = states[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return max;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const statesInOrder = ( ( Object.keys(statePriority)).map(s => Number(s))).sort(cmpPriority);
|
|
36
|
+
const terminalStatePriorities = {
|
|
37
|
+
[3 ]: 0,
|
|
38
|
+
[5 ]: 1,
|
|
39
|
+
[4 ]: 2,
|
|
40
|
+
[6 ]: 3,
|
|
41
|
+
};
|
|
42
|
+
const makeEmptyCounts = () => {
|
|
43
|
+
return ( new Uint32Array(statesInOrder.length));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { cmpPriority, makeEmptyCounts, maxPriority, statePriority, statesInOrder, terminalStatePriorities };
|