@codingame/monaco-vscode-extensions-service-override 4.1.0 → 4.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/_virtual/semver.js +3 -0
- package/extensions.js +6 -6
- package/external/vscode-semver/semver.js +985 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
- package/package.json +9 -9
- package/vscode/src/vs/base/common/console.js +62 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +44 -0
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
- package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
- package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -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 +254 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +207 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +108 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +98 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +560 -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 +579 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +435 -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 +79 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +253 -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 +414 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +501 -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 +208 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +369 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1016 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +185 -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 +137 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +194 -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 +374 -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/mainThreadProfileContentHandlers.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +42 -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 +493 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +168 -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/mainThreadSpeech.js +99 -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 +409 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +51 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +219 -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 +312 -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 +268 -0
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +76 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +285 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +276 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1149 -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 +512 -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/lazyCreateExtensionHostManager.js +161 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +222 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
4
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
5
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
6
|
+
import { EditorActivation } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
7
|
+
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
8
|
+
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
|
|
9
|
+
import { editorGroupToColumn, columnToEditorGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupColumn';
|
|
10
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
11
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
12
|
+
import { ExtHostContext, NotebookEditorRevealType } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
13
|
+
|
|
14
|
+
class MainThreadNotebook {
|
|
15
|
+
constructor(editor, disposables) {
|
|
16
|
+
this.editor = editor;
|
|
17
|
+
this.disposables = disposables;
|
|
18
|
+
}
|
|
19
|
+
dispose() {
|
|
20
|
+
this.disposables.dispose();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let MainThreadNotebookEditors = class MainThreadNotebookEditors {
|
|
24
|
+
constructor(extHostContext, _editorService, _notebookEditorService, _editorGroupService, _configurationService) {
|
|
25
|
+
this._editorService = _editorService;
|
|
26
|
+
this._notebookEditorService = _notebookEditorService;
|
|
27
|
+
this._editorGroupService = _editorGroupService;
|
|
28
|
+
this._configurationService = _configurationService;
|
|
29
|
+
this._disposables = ( new DisposableStore());
|
|
30
|
+
this._mainThreadEditors = ( new Map());
|
|
31
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookEditors));
|
|
32
|
+
this._editorService.onDidActiveEditorChange(() => this._updateEditorViewColumns(), this, this._disposables);
|
|
33
|
+
this._editorGroupService.onDidRemoveGroup(() => this._updateEditorViewColumns(), this, this._disposables);
|
|
34
|
+
this._editorGroupService.onDidMoveGroup(() => this._updateEditorViewColumns(), this, this._disposables);
|
|
35
|
+
}
|
|
36
|
+
dispose() {
|
|
37
|
+
this._disposables.dispose();
|
|
38
|
+
dispose(( this._mainThreadEditors.values()));
|
|
39
|
+
}
|
|
40
|
+
handleEditorsAdded(editors) {
|
|
41
|
+
for (const editor of editors) {
|
|
42
|
+
const editorDisposables = ( new DisposableStore());
|
|
43
|
+
editorDisposables.add(editor.onDidChangeVisibleRanges(() => {
|
|
44
|
+
this._proxy.$acceptEditorPropertiesChanged(editor.getId(), { visibleRanges: { ranges: editor.visibleRanges } });
|
|
45
|
+
}));
|
|
46
|
+
editorDisposables.add(editor.onDidChangeSelection(() => {
|
|
47
|
+
this._proxy.$acceptEditorPropertiesChanged(editor.getId(), { selections: { selections: editor.getSelections() } });
|
|
48
|
+
}));
|
|
49
|
+
const wrapper = ( new MainThreadNotebook(editor, editorDisposables));
|
|
50
|
+
this._mainThreadEditors.set(editor.getId(), wrapper);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleEditorsRemoved(editorIds) {
|
|
54
|
+
for (const id of editorIds) {
|
|
55
|
+
this._mainThreadEditors.get(id)?.dispose();
|
|
56
|
+
this._mainThreadEditors.delete(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
_updateEditorViewColumns() {
|
|
60
|
+
const result = Object.create(null);
|
|
61
|
+
for (const editorPane of this._editorService.visibleEditorPanes) {
|
|
62
|
+
const candidate = getNotebookEditorFromEditorPane(editorPane);
|
|
63
|
+
if (candidate && ( this._mainThreadEditors.has(candidate.getId()))) {
|
|
64
|
+
result[candidate.getId()] = editorGroupToColumn(this._editorGroupService, editorPane.group);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!equals(result, this._currentViewColumnInfo)) {
|
|
68
|
+
this._currentViewColumnInfo = result;
|
|
69
|
+
this._proxy.$acceptEditorViewColumns(result);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async $tryShowNotebookDocument(resource, viewType, options) {
|
|
73
|
+
const editorOptions = {
|
|
74
|
+
cellSelections: options.selections,
|
|
75
|
+
preserveFocus: options.preserveFocus,
|
|
76
|
+
pinned: options.pinned,
|
|
77
|
+
activation: options.preserveFocus ? EditorActivation.RESTORE : undefined,
|
|
78
|
+
override: viewType
|
|
79
|
+
};
|
|
80
|
+
const editorPane = await this._editorService.openEditor({ resource: URI.revive(resource), options: editorOptions }, columnToEditorGroup(this._editorGroupService, this._configurationService, options.position));
|
|
81
|
+
const notebookEditor = getNotebookEditorFromEditorPane(editorPane);
|
|
82
|
+
if (notebookEditor) {
|
|
83
|
+
return notebookEditor.getId();
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw new Error(`Notebook Editor creation failure for document ${JSON.stringify(resource)}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async $tryRevealRange(id, range, revealType) {
|
|
90
|
+
const editor = this._notebookEditorService.getNotebookEditor(id);
|
|
91
|
+
if (!editor) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const notebookEditor = editor;
|
|
95
|
+
if (!notebookEditor.hasModel()) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (range.start >= notebookEditor.getLength()) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const cell = notebookEditor.cellAt(range.start);
|
|
102
|
+
switch (revealType) {
|
|
103
|
+
case NotebookEditorRevealType.Default:
|
|
104
|
+
return notebookEditor.revealCellRangeInView(range);
|
|
105
|
+
case NotebookEditorRevealType.InCenter:
|
|
106
|
+
return notebookEditor.revealInCenter(cell);
|
|
107
|
+
case NotebookEditorRevealType.InCenterIfOutsideViewport:
|
|
108
|
+
return notebookEditor.revealInCenterIfOutsideViewport(cell);
|
|
109
|
+
case NotebookEditorRevealType.AtTop:
|
|
110
|
+
return notebookEditor.revealInViewAtTop(cell);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
$trySetSelections(id, ranges) {
|
|
114
|
+
const editor = this._notebookEditorService.getNotebookEditor(id);
|
|
115
|
+
if (!editor) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
editor.setSelections(ranges);
|
|
119
|
+
if (ranges.length) {
|
|
120
|
+
editor.setFocus({ start: ranges[0].start, end: ranges[0].start + 1 });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
MainThreadNotebookEditors = ( __decorate([
|
|
125
|
+
( __param(1, IEditorService)),
|
|
126
|
+
( __param(2, INotebookEditorService)),
|
|
127
|
+
( __param(3, IEditorGroupsService)),
|
|
128
|
+
( __param(4, IConfigurationService))
|
|
129
|
+
], MainThreadNotebookEditors));
|
|
130
|
+
|
|
131
|
+
export { MainThreadNotebookEditors };
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
5
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
+
import { DisposableMap, DisposableStore, toDisposable, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
9
|
+
import { NotebookDto } from './mainThreadNotebookDto.js';
|
|
10
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
11
|
+
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
|
|
12
|
+
import { INotebookExecutionStateService, NotebookExecutionType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
13
|
+
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
14
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
15
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
16
|
+
import { AsyncIterableSource } from 'vscode/vscode/vs/base/common/async';
|
|
17
|
+
|
|
18
|
+
class MainThreadKernel {
|
|
19
|
+
get preloadUris() {
|
|
20
|
+
return ( this.preloads.map(p => p.uri));
|
|
21
|
+
}
|
|
22
|
+
get preloadProvides() {
|
|
23
|
+
return this.preloads.flatMap(p => p.provides);
|
|
24
|
+
}
|
|
25
|
+
constructor(data, _languageService) {
|
|
26
|
+
this._languageService = _languageService;
|
|
27
|
+
this._onDidChange = ( new Emitter());
|
|
28
|
+
this.onDidChange = this._onDidChange.event;
|
|
29
|
+
this.id = data.id;
|
|
30
|
+
this.viewType = data.notebookType;
|
|
31
|
+
this.extension = data.extensionId;
|
|
32
|
+
this.implementsInterrupt = data.supportsInterrupt ?? false;
|
|
33
|
+
this.label = data.label;
|
|
34
|
+
this.description = data.description;
|
|
35
|
+
this.detail = data.detail;
|
|
36
|
+
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _languageService.getRegisteredLanguageIds();
|
|
37
|
+
this.implementsExecutionOrder = data.supportsExecutionOrder ?? false;
|
|
38
|
+
this.hasVariableProvider = data.hasVariableProvider ?? false;
|
|
39
|
+
this.localResourceRoot = URI.revive(data.extensionLocation);
|
|
40
|
+
this.preloads = data.preloads?.map(u => ({ uri: URI.revive(u.uri), provides: u.provides })) ?? [];
|
|
41
|
+
}
|
|
42
|
+
update(data) {
|
|
43
|
+
const event = Object.create(null);
|
|
44
|
+
if (data.label !== undefined) {
|
|
45
|
+
this.label = data.label;
|
|
46
|
+
event.label = true;
|
|
47
|
+
}
|
|
48
|
+
if (data.description !== undefined) {
|
|
49
|
+
this.description = data.description;
|
|
50
|
+
event.description = true;
|
|
51
|
+
}
|
|
52
|
+
if (data.detail !== undefined) {
|
|
53
|
+
this.detail = data.detail;
|
|
54
|
+
event.detail = true;
|
|
55
|
+
}
|
|
56
|
+
if (data.supportedLanguages !== undefined) {
|
|
57
|
+
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._languageService.getRegisteredLanguageIds();
|
|
58
|
+
event.supportedLanguages = true;
|
|
59
|
+
}
|
|
60
|
+
if (data.supportsExecutionOrder !== undefined) {
|
|
61
|
+
this.implementsExecutionOrder = data.supportsExecutionOrder;
|
|
62
|
+
event.hasExecutionOrder = true;
|
|
63
|
+
}
|
|
64
|
+
if (data.supportsInterrupt !== undefined) {
|
|
65
|
+
this.implementsInterrupt = data.supportsInterrupt;
|
|
66
|
+
event.hasInterruptHandler = true;
|
|
67
|
+
}
|
|
68
|
+
if (data.hasVariableProvider !== undefined) {
|
|
69
|
+
this.hasVariableProvider = data.hasVariableProvider;
|
|
70
|
+
event.hasVariableProvider = true;
|
|
71
|
+
}
|
|
72
|
+
this._onDidChange.fire(event);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class MainThreadKernelDetectionTask {
|
|
76
|
+
constructor(notebookType) {
|
|
77
|
+
this.notebookType = notebookType;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
let MainThreadNotebookKernels = class MainThreadNotebookKernels {
|
|
81
|
+
constructor(extHostContext, _languageService, _notebookKernelService, _notebookExecutionStateService, _notebookService, notebookEditorService) {
|
|
82
|
+
this._languageService = _languageService;
|
|
83
|
+
this._notebookKernelService = _notebookKernelService;
|
|
84
|
+
this._notebookExecutionStateService = _notebookExecutionStateService;
|
|
85
|
+
this._notebookService = _notebookService;
|
|
86
|
+
this._editors = ( new DisposableMap());
|
|
87
|
+
this._disposables = ( new DisposableStore());
|
|
88
|
+
this._kernels = ( new Map());
|
|
89
|
+
this._kernelDetectionTasks = ( new Map());
|
|
90
|
+
this._kernelSourceActionProviders = ( new Map());
|
|
91
|
+
this._kernelSourceActionProvidersEventRegistrations = ( new Map());
|
|
92
|
+
this._executions = ( new Map());
|
|
93
|
+
this._notebookExecutions = ( new Map());
|
|
94
|
+
this.variableRequestIndex = 0;
|
|
95
|
+
this.variableRequestMap = ( new Map());
|
|
96
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookKernels));
|
|
97
|
+
notebookEditorService.listNotebookEditors().forEach(this._onEditorAdd, this);
|
|
98
|
+
notebookEditorService.onDidAddNotebookEditor(this._onEditorAdd, this, this._disposables);
|
|
99
|
+
notebookEditorService.onDidRemoveNotebookEditor(this._onEditorRemove, this, this._disposables);
|
|
100
|
+
this._disposables.add(toDisposable(() => {
|
|
101
|
+
this._executions.forEach(e => {
|
|
102
|
+
e.complete({});
|
|
103
|
+
});
|
|
104
|
+
this._notebookExecutions.forEach(e => e.complete());
|
|
105
|
+
}));
|
|
106
|
+
this._disposables.add(this._notebookExecutionStateService.onDidChangeExecution(e => {
|
|
107
|
+
if (e.type === NotebookExecutionType.cell) {
|
|
108
|
+
this._proxy.$cellExecutionChanged(e.notebook, e.cellHandle, e.changed?.state);
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
dispose() {
|
|
113
|
+
this._disposables.dispose();
|
|
114
|
+
for (const [, registration] of ( this._kernels.values())) {
|
|
115
|
+
registration.dispose();
|
|
116
|
+
}
|
|
117
|
+
for (const [, registration] of ( this._kernelDetectionTasks.values())) {
|
|
118
|
+
registration.dispose();
|
|
119
|
+
}
|
|
120
|
+
for (const [, registration] of ( this._kernelSourceActionProviders.values())) {
|
|
121
|
+
registration.dispose();
|
|
122
|
+
}
|
|
123
|
+
this._editors.dispose();
|
|
124
|
+
}
|
|
125
|
+
_onEditorAdd(editor) {
|
|
126
|
+
const ipcListener = editor.onDidReceiveMessage(e => {
|
|
127
|
+
if (!editor.hasModel()) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const { selected } = this._notebookKernelService.getMatchingKernel(editor.textModel);
|
|
131
|
+
if (!selected) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
for (const [handle, candidate] of this._kernels) {
|
|
135
|
+
if (candidate[0] === selected) {
|
|
136
|
+
this._proxy.$acceptKernelMessageFromRenderer(handle, editor.getId(), e.message);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
this._editors.set(editor, ipcListener);
|
|
142
|
+
}
|
|
143
|
+
_onEditorRemove(editor) {
|
|
144
|
+
this._editors.deleteAndDispose(editor);
|
|
145
|
+
}
|
|
146
|
+
async $postMessage(handle, editorId, message) {
|
|
147
|
+
const tuple = this._kernels.get(handle);
|
|
148
|
+
if (!tuple) {
|
|
149
|
+
throw new Error('kernel already disposed');
|
|
150
|
+
}
|
|
151
|
+
const [kernel] = tuple;
|
|
152
|
+
let didSend = false;
|
|
153
|
+
for (const [editor] of this._editors) {
|
|
154
|
+
if (!editor.hasModel()) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (this._notebookKernelService.getMatchingKernel(editor.textModel).selected !== kernel) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (editorId === undefined) {
|
|
161
|
+
editor.postMessage(message);
|
|
162
|
+
didSend = true;
|
|
163
|
+
}
|
|
164
|
+
else if (editor.getId() === editorId) {
|
|
165
|
+
editor.postMessage(message);
|
|
166
|
+
didSend = true;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return didSend;
|
|
171
|
+
}
|
|
172
|
+
$receiveVariable(requestId, variable) {
|
|
173
|
+
const source = this.variableRequestMap.get(requestId);
|
|
174
|
+
if (source) {
|
|
175
|
+
source.emitOne(variable);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async $addKernel(handle, data) {
|
|
179
|
+
const that = this;
|
|
180
|
+
const kernel = new (class extends MainThreadKernel {
|
|
181
|
+
async executeNotebookCellsRequest(uri, handles) {
|
|
182
|
+
await that._proxy.$executeCells(handle, uri, handles);
|
|
183
|
+
}
|
|
184
|
+
async cancelNotebookCellExecution(uri, handles) {
|
|
185
|
+
await that._proxy.$cancelCells(handle, uri, handles);
|
|
186
|
+
}
|
|
187
|
+
provideVariables(notebookUri, parentId, kind, start, token) {
|
|
188
|
+
const requestId = `${handle}variables${that.variableRequestIndex++}`;
|
|
189
|
+
if (( that.variableRequestMap.has(requestId))) {
|
|
190
|
+
return that.variableRequestMap.get(requestId).asyncIterable;
|
|
191
|
+
}
|
|
192
|
+
const source = ( new AsyncIterableSource());
|
|
193
|
+
that.variableRequestMap.set(requestId, source);
|
|
194
|
+
that._proxy.$provideVariables(handle, requestId, notebookUri, parentId, kind, start, token).then(() => {
|
|
195
|
+
source.resolve();
|
|
196
|
+
that.variableRequestMap.delete(requestId);
|
|
197
|
+
}).catch((err) => {
|
|
198
|
+
source.reject(err);
|
|
199
|
+
that.variableRequestMap.delete(requestId);
|
|
200
|
+
});
|
|
201
|
+
return source.asyncIterable;
|
|
202
|
+
}
|
|
203
|
+
})(data, this._languageService);
|
|
204
|
+
const listener = this._notebookKernelService.onDidChangeSelectedNotebooks(e => {
|
|
205
|
+
if (e.oldKernel === kernel.id) {
|
|
206
|
+
this._proxy.$acceptNotebookAssociation(handle, e.notebook, false);
|
|
207
|
+
}
|
|
208
|
+
else if (e.newKernel === kernel.id) {
|
|
209
|
+
this._proxy.$acceptNotebookAssociation(handle, e.notebook, true);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const registration = this._notebookKernelService.registerKernel(kernel);
|
|
213
|
+
this._kernels.set(handle, [kernel, combinedDisposable(listener, registration)]);
|
|
214
|
+
}
|
|
215
|
+
$updateKernel(handle, data) {
|
|
216
|
+
const tuple = this._kernels.get(handle);
|
|
217
|
+
if (tuple) {
|
|
218
|
+
tuple[0].update(data);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
$removeKernel(handle) {
|
|
222
|
+
const tuple = this._kernels.get(handle);
|
|
223
|
+
if (tuple) {
|
|
224
|
+
tuple[1].dispose();
|
|
225
|
+
this._kernels.delete(handle);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
$updateNotebookPriority(handle, notebook, value) {
|
|
229
|
+
const tuple = this._kernels.get(handle);
|
|
230
|
+
if (tuple) {
|
|
231
|
+
this._notebookKernelService.updateKernelNotebookAffinity(tuple[0], URI.revive(notebook), value);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
$createExecution(handle, controllerId, rawUri, cellHandle) {
|
|
235
|
+
const uri = URI.revive(rawUri);
|
|
236
|
+
const notebook = this._notebookService.getNotebookTextModel(uri);
|
|
237
|
+
if (!notebook) {
|
|
238
|
+
throw new Error(`Notebook not found: ${uri.toString()}`);
|
|
239
|
+
}
|
|
240
|
+
const kernel = this._notebookKernelService.getMatchingKernel(notebook);
|
|
241
|
+
if (!kernel.selected || kernel.selected.id !== controllerId) {
|
|
242
|
+
throw new Error(`Kernel is not selected: ${kernel.selected?.id} !== ${controllerId}`);
|
|
243
|
+
}
|
|
244
|
+
const execution = this._notebookExecutionStateService.createCellExecution(uri, cellHandle);
|
|
245
|
+
execution.confirm();
|
|
246
|
+
this._executions.set(handle, execution);
|
|
247
|
+
}
|
|
248
|
+
$updateExecution(handle, data) {
|
|
249
|
+
const updates = data.value;
|
|
250
|
+
try {
|
|
251
|
+
const execution = this._executions.get(handle);
|
|
252
|
+
execution?.update(( updates.map(NotebookDto.fromCellExecuteUpdateDto)));
|
|
253
|
+
}
|
|
254
|
+
catch (e) {
|
|
255
|
+
onUnexpectedError(e);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
$completeExecution(handle, data) {
|
|
259
|
+
try {
|
|
260
|
+
const execution = this._executions.get(handle);
|
|
261
|
+
execution?.complete(NotebookDto.fromCellExecuteCompleteDto(data.value));
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
onUnexpectedError(e);
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
this._executions.delete(handle);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
$createNotebookExecution(handle, controllerId, rawUri) {
|
|
271
|
+
const uri = URI.revive(rawUri);
|
|
272
|
+
const notebook = this._notebookService.getNotebookTextModel(uri);
|
|
273
|
+
if (!notebook) {
|
|
274
|
+
throw new Error(`Notebook not found: ${uri.toString()}`);
|
|
275
|
+
}
|
|
276
|
+
const kernel = this._notebookKernelService.getMatchingKernel(notebook);
|
|
277
|
+
if (!kernel.selected || kernel.selected.id !== controllerId) {
|
|
278
|
+
throw new Error(`Kernel is not selected: ${kernel.selected?.id} !== ${controllerId}`);
|
|
279
|
+
}
|
|
280
|
+
const execution = this._notebookExecutionStateService.createExecution(uri);
|
|
281
|
+
execution.confirm();
|
|
282
|
+
this._notebookExecutions.set(handle, execution);
|
|
283
|
+
}
|
|
284
|
+
$beginNotebookExecution(handle) {
|
|
285
|
+
try {
|
|
286
|
+
const execution = this._notebookExecutions.get(handle);
|
|
287
|
+
execution?.begin();
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
onUnexpectedError(e);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
$completeNotebookExecution(handle) {
|
|
294
|
+
try {
|
|
295
|
+
const execution = this._notebookExecutions.get(handle);
|
|
296
|
+
execution?.complete();
|
|
297
|
+
}
|
|
298
|
+
catch (e) {
|
|
299
|
+
onUnexpectedError(e);
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
this._notebookExecutions.delete(handle);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async $addKernelDetectionTask(handle, notebookType) {
|
|
306
|
+
const kernelDetectionTask = ( new MainThreadKernelDetectionTask(notebookType));
|
|
307
|
+
const registration = this._notebookKernelService.registerNotebookKernelDetectionTask(kernelDetectionTask);
|
|
308
|
+
this._kernelDetectionTasks.set(handle, [kernelDetectionTask, registration]);
|
|
309
|
+
}
|
|
310
|
+
$removeKernelDetectionTask(handle) {
|
|
311
|
+
const tuple = this._kernelDetectionTasks.get(handle);
|
|
312
|
+
if (tuple) {
|
|
313
|
+
tuple[1].dispose();
|
|
314
|
+
this._kernelDetectionTasks.delete(handle);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
async $addKernelSourceActionProvider(handle, eventHandle, notebookType) {
|
|
318
|
+
const kernelSourceActionProvider = {
|
|
319
|
+
viewType: notebookType,
|
|
320
|
+
provideKernelSourceActions: async () => {
|
|
321
|
+
const actions = await this._proxy.$provideKernelSourceActions(handle, CancellationToken.None);
|
|
322
|
+
return ( actions.map(action => {
|
|
323
|
+
let documentation = action.documentation;
|
|
324
|
+
if (action.documentation && typeof action.documentation !== 'string') {
|
|
325
|
+
documentation = URI.revive(action.documentation);
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
label: action.label,
|
|
329
|
+
command: action.command,
|
|
330
|
+
description: action.description,
|
|
331
|
+
detail: action.detail,
|
|
332
|
+
documentation,
|
|
333
|
+
};
|
|
334
|
+
}));
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
if (typeof eventHandle === 'number') {
|
|
338
|
+
const emitter = ( new Emitter());
|
|
339
|
+
this._kernelSourceActionProvidersEventRegistrations.set(eventHandle, emitter);
|
|
340
|
+
kernelSourceActionProvider.onDidChangeSourceActions = emitter.event;
|
|
341
|
+
}
|
|
342
|
+
const registration = this._notebookKernelService.registerKernelSourceActionProvider(notebookType, kernelSourceActionProvider);
|
|
343
|
+
this._kernelSourceActionProviders.set(handle, [kernelSourceActionProvider, registration]);
|
|
344
|
+
}
|
|
345
|
+
$removeKernelSourceActionProvider(handle, eventHandle) {
|
|
346
|
+
const tuple = this._kernelSourceActionProviders.get(handle);
|
|
347
|
+
if (tuple) {
|
|
348
|
+
tuple[1].dispose();
|
|
349
|
+
this._kernelSourceActionProviders.delete(handle);
|
|
350
|
+
}
|
|
351
|
+
if (typeof eventHandle === 'number') {
|
|
352
|
+
this._kernelSourceActionProvidersEventRegistrations.delete(eventHandle);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
$emitNotebookKernelSourceActionsChangeEvent(eventHandle) {
|
|
356
|
+
const emitter = this._kernelSourceActionProvidersEventRegistrations.get(eventHandle);
|
|
357
|
+
if (emitter instanceof Emitter) {
|
|
358
|
+
emitter.fire(undefined);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
$variablesUpdated(notebookUri) {
|
|
362
|
+
this._notebookKernelService.notifyVariablesChange(URI.revive(notebookUri));
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
MainThreadNotebookKernels = __decorate([
|
|
366
|
+
extHostNamedCustomer(MainContext.MainThreadNotebookKernels),
|
|
367
|
+
( __param(1, ILanguageService)),
|
|
368
|
+
( __param(2, INotebookKernelService)),
|
|
369
|
+
( __param(3, INotebookExecutionStateService)),
|
|
370
|
+
( __param(4, INotebookService)),
|
|
371
|
+
( __param(5, INotebookEditorService))
|
|
372
|
+
], MainThreadNotebookKernels);
|
|
373
|
+
|
|
374
|
+
export { MainThreadNotebookKernels };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
4
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
5
|
+
import { INotebookRendererMessagingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookRendererMessagingService';
|
|
6
|
+
|
|
7
|
+
let MainThreadNotebookRenderers = class MainThreadNotebookRenderers extends Disposable {
|
|
8
|
+
constructor(extHostContext, messaging) {
|
|
9
|
+
super();
|
|
10
|
+
this.messaging = messaging;
|
|
11
|
+
this.proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookRenderers));
|
|
12
|
+
this._register(messaging.onShouldPostMessage(e => {
|
|
13
|
+
this.proxy.$postRendererMessage(e.editorId, e.rendererId, e.message);
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
$postMessage(editorId, rendererId, message) {
|
|
17
|
+
return this.messaging.receiveMessage(editorId, rendererId, message);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
MainThreadNotebookRenderers = __decorate([
|
|
21
|
+
extHostNamedCustomer(MainContext.MainThreadNotebookRenderers),
|
|
22
|
+
( __param(1, INotebookRendererMessagingService))
|
|
23
|
+
], MainThreadNotebookRenderers);
|
|
24
|
+
|
|
25
|
+
export { MainThreadNotebookRenderers };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
+
import { extHostCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
5
|
+
import { ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
6
|
+
import { raceCancellationError } from 'vscode/vscode/vs/base/common/async';
|
|
7
|
+
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
|
|
8
|
+
import { NotebookFileWorkingCopyModel } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel';
|
|
9
|
+
|
|
10
|
+
class ExtHostNotebookDocumentSaveParticipant {
|
|
11
|
+
constructor(extHostContext) {
|
|
12
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookDocumentSaveParticipant));
|
|
13
|
+
}
|
|
14
|
+
async participate(workingCopy, context, _progress, token) {
|
|
15
|
+
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
let _warningTimeout;
|
|
19
|
+
const p = ( new Promise((resolve, reject) => {
|
|
20
|
+
_warningTimeout = setTimeout(() => reject(( new Error(( localizeWithPath(
|
|
21
|
+
'vs/workbench/api/browser/mainThreadNotebookSaveParticipant',
|
|
22
|
+
'timeout.onWillSave',
|
|
23
|
+
"Aborted onWillSaveNotebookDocument-event after 1750ms"
|
|
24
|
+
))))), 1750);
|
|
25
|
+
this._proxy.$participateInSave(workingCopy.resource, context.reason, token).then(_ => {
|
|
26
|
+
clearTimeout(_warningTimeout);
|
|
27
|
+
return undefined;
|
|
28
|
+
}).then(resolve, reject);
|
|
29
|
+
}));
|
|
30
|
+
return raceCancellationError(p, token);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let SaveParticipant = class SaveParticipant {
|
|
34
|
+
constructor(extHostContext, instantiationService, workingCopyFileService) {
|
|
35
|
+
this.workingCopyFileService = workingCopyFileService;
|
|
36
|
+
this._saveParticipantDisposable = this.workingCopyFileService.addSaveParticipant(instantiationService.createInstance(ExtHostNotebookDocumentSaveParticipant, extHostContext));
|
|
37
|
+
}
|
|
38
|
+
dispose() {
|
|
39
|
+
this._saveParticipantDisposable.dispose();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
SaveParticipant = __decorate([
|
|
43
|
+
extHostCustomer,
|
|
44
|
+
( __param(1, IInstantiationService)),
|
|
45
|
+
( __param(2, IWorkingCopyFileService))
|
|
46
|
+
], SaveParticipant);
|
|
47
|
+
|
|
48
|
+
export { SaveParticipant };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
+
import { OUTPUT_VIEW_ID, Extensions, OutputChannelUpdateMode, IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
4
|
+
import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
5
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
6
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
7
|
+
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
9
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
10
|
+
import { isNumber } from 'vscode/vscode/vs/base/common/types';
|
|
11
|
+
|
|
12
|
+
var MainThreadOutputService_1;
|
|
13
|
+
let MainThreadOutputService = class MainThreadOutputService extends Disposable {
|
|
14
|
+
static { MainThreadOutputService_1 = this; }
|
|
15
|
+
static { this._extensionIdPool = ( new Map()); }
|
|
16
|
+
constructor(extHostContext, outputService, viewsService) {
|
|
17
|
+
super();
|
|
18
|
+
this._outputService = outputService;
|
|
19
|
+
this._viewsService = viewsService;
|
|
20
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostOutputService));
|
|
21
|
+
const setVisibleChannel = () => {
|
|
22
|
+
const visibleChannel = this._viewsService.isViewVisible(OUTPUT_VIEW_ID) ? this._outputService.getActiveChannel() : undefined;
|
|
23
|
+
this._proxy.$setVisibleChannel(visibleChannel ? visibleChannel.id : null);
|
|
24
|
+
};
|
|
25
|
+
this._register(Event.any(this._outputService.onActiveOutputChannel, Event.filter(this._viewsService.onDidChangeViewVisibility, ({ id }) => id === OUTPUT_VIEW_ID))(() => setVisibleChannel()));
|
|
26
|
+
setVisibleChannel();
|
|
27
|
+
}
|
|
28
|
+
async $register(label, file, languageId, extensionId) {
|
|
29
|
+
const idCounter = (MainThreadOutputService_1._extensionIdPool.get(extensionId) || 0) + 1;
|
|
30
|
+
MainThreadOutputService_1._extensionIdPool.set(extensionId, idCounter);
|
|
31
|
+
const id = `extension-output-${extensionId}-#${idCounter}-${label}`;
|
|
32
|
+
const resource = URI.revive(file);
|
|
33
|
+
( Registry.as(Extensions.OutputChannels)).registerChannel({ id, label, file: resource, log: false, languageId, extensionId });
|
|
34
|
+
this._register(toDisposable(() => this.$dispose(id)));
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
37
|
+
async $update(channelId, mode, till) {
|
|
38
|
+
const channel = this._getChannel(channelId);
|
|
39
|
+
if (channel) {
|
|
40
|
+
if (mode === OutputChannelUpdateMode.Append) {
|
|
41
|
+
channel.update(mode);
|
|
42
|
+
}
|
|
43
|
+
else if (isNumber(till)) {
|
|
44
|
+
channel.update(mode, till);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async $reveal(channelId, preserveFocus) {
|
|
49
|
+
const channel = this._getChannel(channelId);
|
|
50
|
+
if (channel) {
|
|
51
|
+
this._outputService.showChannel(channel.id, preserveFocus);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async $close(channelId) {
|
|
55
|
+
if (this._viewsService.isViewVisible(OUTPUT_VIEW_ID)) {
|
|
56
|
+
const activeChannel = this._outputService.getActiveChannel();
|
|
57
|
+
if (activeChannel && channelId === activeChannel.id) {
|
|
58
|
+
this._viewsService.closeView(OUTPUT_VIEW_ID);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async $dispose(channelId) {
|
|
63
|
+
const channel = this._getChannel(channelId);
|
|
64
|
+
channel?.dispose();
|
|
65
|
+
}
|
|
66
|
+
_getChannel(channelId) {
|
|
67
|
+
return this._outputService.getChannel(channelId);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
MainThreadOutputService = MainThreadOutputService_1 = __decorate([
|
|
71
|
+
extHostNamedCustomer(MainContext.MainThreadOutputService),
|
|
72
|
+
( __param(1, IOutputService)),
|
|
73
|
+
( __param(2, IViewsService))
|
|
74
|
+
], MainThreadOutputService);
|
|
75
|
+
|
|
76
|
+
export { MainThreadOutputService };
|