@codingame/monaco-vscode-notebook-service-override 37.1.0 → 37.3.0
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/index.js +7 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.d.ts +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +210 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.d.ts +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +140 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.d.ts +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +194 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +149 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +372 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.d.ts +10 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +26 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.d.ts +9 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +43 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +19 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +32 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +30 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +11 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +38 -38
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +30 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +68 -68
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +35 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +15 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +26 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +352 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +44 -18
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +14 -14
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -5
package/index.js
CHANGED
|
@@ -30,14 +30,19 @@ import { NotebookDocumentWorkbenchService } from '@codingame/monaco-vscode-api/v
|
|
|
30
30
|
import { INotebookDocumentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/notebook/common/notebookDocumentService.service';
|
|
31
31
|
import { INotebookOriginalCellModelFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.service';
|
|
32
32
|
import { INotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.service';
|
|
33
|
-
import { OriginalNotebookCellModelFactory } from '@codingame/monaco-vscode-
|
|
34
|
-
import { NotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-
|
|
33
|
+
import { OriginalNotebookCellModelFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory';
|
|
34
|
+
import { NotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory';
|
|
35
35
|
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service';
|
|
36
36
|
import { NotebookCellOutlineDataSourceFactory } from './vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js';
|
|
37
37
|
import { NotebookOutlineEntryFactory } from './vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js';
|
|
38
38
|
import { INotebookOutlineEntryFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service';
|
|
39
39
|
import './vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js';
|
|
40
40
|
import './vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js';
|
|
41
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadNotebook.js';
|
|
42
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js';
|
|
43
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js';
|
|
44
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js';
|
|
45
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js';
|
|
41
46
|
|
|
42
47
|
function getServiceOverride() {
|
|
43
48
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-notebook-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - notebook service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "37.
|
|
19
|
-
"@codingame/monaco-vscode-katex-common": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.3.0",
|
|
19
|
+
"@codingame/monaco-vscode-katex-common": "37.3.0"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
2
|
+
import { INotebookCellStatusBarService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService.service";
|
|
3
|
+
import { INotebookContributionData, NotebookExtensionDescription, TransientOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
4
|
+
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
5
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
6
|
+
import { MainThreadNotebookShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
|
|
7
|
+
export declare class MainThreadNotebooks implements MainThreadNotebookShape {
|
|
8
|
+
private readonly _notebookService;
|
|
9
|
+
private readonly _cellStatusBarService;
|
|
10
|
+
private readonly _logService;
|
|
11
|
+
private readonly _disposables;
|
|
12
|
+
private readonly _proxy;
|
|
13
|
+
private readonly _notebookSerializer;
|
|
14
|
+
private readonly _notebookCellStatusBarRegistrations;
|
|
15
|
+
constructor(extHostContext: IExtHostContext, _notebookService: INotebookService, _cellStatusBarService: INotebookCellStatusBarService, _logService: ILogService);
|
|
16
|
+
dispose(): void;
|
|
17
|
+
$registerNotebookSerializer(handle: number, extension: NotebookExtensionDescription, viewType: string, options: TransientOptions, data: INotebookContributionData | undefined): void;
|
|
18
|
+
$unregisterNotebookSerializer(handle: number): void;
|
|
19
|
+
$emitCellStatusBarEvent(eventHandle: number): void;
|
|
20
|
+
$registerNotebookCellStatusBarItemProvider(handle: number, eventHandle: number | undefined, viewType: string): Promise<void>;
|
|
21
|
+
$unregisterNotebookCellStatusBarItemProvider(handle: number, eventHandle: number | undefined): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
8
|
+
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
10
|
+
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
11
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
12
|
+
import { NotebookDto } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/browser/mainThreadNotebookDto';
|
|
13
|
+
import { INotebookCellStatusBarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService.service';
|
|
14
|
+
import { SimpleNotebookProviderInfo } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
15
|
+
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
16
|
+
import { extHostNamedCustomer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers';
|
|
17
|
+
import { SerializableObjectWithBuffers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier';
|
|
18
|
+
import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
|
|
19
|
+
import { revive } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshalling';
|
|
20
|
+
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
21
|
+
import { FileOperationError } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
22
|
+
|
|
23
|
+
let MainThreadNotebooks = class MainThreadNotebooks {
|
|
24
|
+
constructor(extHostContext, _notebookService, _cellStatusBarService, _logService) {
|
|
25
|
+
this._notebookService = _notebookService;
|
|
26
|
+
this._cellStatusBarService = _cellStatusBarService;
|
|
27
|
+
this._logService = _logService;
|
|
28
|
+
this._disposables = ( new DisposableStore());
|
|
29
|
+
this._notebookSerializer = ( new Map());
|
|
30
|
+
this._notebookCellStatusBarRegistrations = ( new Map());
|
|
31
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebook));
|
|
32
|
+
}
|
|
33
|
+
dispose() {
|
|
34
|
+
this._disposables.dispose();
|
|
35
|
+
dispose(( this._notebookSerializer.values()));
|
|
36
|
+
dispose(( this._notebookCellStatusBarRegistrations.values()));
|
|
37
|
+
this._notebookCellStatusBarRegistrations.clear();
|
|
38
|
+
}
|
|
39
|
+
$registerNotebookSerializer(handle, extension, viewType, options, data) {
|
|
40
|
+
const disposables = ( new DisposableStore());
|
|
41
|
+
disposables.add(this._notebookService.registerNotebookSerializer(viewType, extension, {
|
|
42
|
+
options,
|
|
43
|
+
dataToNotebook: async data => {
|
|
44
|
+
const sw = ( new StopWatch());
|
|
45
|
+
let result;
|
|
46
|
+
if (data.byteLength === 0 && viewType === "interactive") {
|
|
47
|
+
result = NotebookDto.fromNotebookDataDto({
|
|
48
|
+
cells: [],
|
|
49
|
+
metadata: {}
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
const dto = await this._proxy.$dataToNotebook(handle, data, CancellationToken.None);
|
|
53
|
+
result = NotebookDto.fromNotebookDataDto(dto.value);
|
|
54
|
+
}
|
|
55
|
+
this._logService.trace(`[NotebookSerializer] dataToNotebook DONE after ${sw.elapsed()}ms`, {
|
|
56
|
+
viewType,
|
|
57
|
+
extensionId: extension.id.value
|
|
58
|
+
});
|
|
59
|
+
return result;
|
|
60
|
+
},
|
|
61
|
+
notebookToData: data => {
|
|
62
|
+
const sw = ( new StopWatch());
|
|
63
|
+
const result = this._proxy.$notebookToData(handle, ( new SerializableObjectWithBuffers(NotebookDto.toNotebookDataDto(data))), CancellationToken.None);
|
|
64
|
+
this._logService.trace(`[NotebookSerializer] notebookToData DONE after ${sw.elapsed()}`, {
|
|
65
|
+
viewType,
|
|
66
|
+
extensionId: extension.id.value
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
},
|
|
70
|
+
save: async (uri, versionId, options, token) => {
|
|
71
|
+
const stat = await this._proxy.$saveNotebook(handle, uri, versionId, options, token);
|
|
72
|
+
if (isFileOperationError(stat)) {
|
|
73
|
+
throw ( new FileOperationError(stat.message, stat.fileOperationResult, stat.options));
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
...stat,
|
|
77
|
+
children: undefined,
|
|
78
|
+
resource: uri
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
searchInNotebooks: async (textQuery, token, allPriorityInfo) => {
|
|
82
|
+
const contributedType = this._notebookService.getContributedNotebookType(viewType);
|
|
83
|
+
if (!contributedType) {
|
|
84
|
+
return {
|
|
85
|
+
results: [],
|
|
86
|
+
limitHit: false
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const fileNames = contributedType.selectors;
|
|
90
|
+
const includes = fileNames.map(selector => {
|
|
91
|
+
const globPattern = selector.include || selector;
|
|
92
|
+
return ( globPattern.toString());
|
|
93
|
+
});
|
|
94
|
+
if (!includes.length) {
|
|
95
|
+
return {
|
|
96
|
+
results: [],
|
|
97
|
+
limitHit: false
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const thisPriorityInfo = coalesce([{
|
|
101
|
+
isFromSettings: false,
|
|
102
|
+
filenamePatterns: includes
|
|
103
|
+
}, ...(allPriorityInfo.get(viewType) ?? [])]);
|
|
104
|
+
const otherEditorsPriorityInfo = Array.from(( allPriorityInfo.keys())).flatMap(key => {
|
|
105
|
+
if (key !== viewType) {
|
|
106
|
+
return allPriorityInfo.get(key) ?? [];
|
|
107
|
+
}
|
|
108
|
+
return [];
|
|
109
|
+
});
|
|
110
|
+
const searchComplete = await this._proxy.$searchInNotebooks(handle, textQuery, thisPriorityInfo, otherEditorsPriorityInfo, token);
|
|
111
|
+
const revivedResults = searchComplete.results.map(result => {
|
|
112
|
+
const resource = URI.revive(result.resource);
|
|
113
|
+
return {
|
|
114
|
+
resource,
|
|
115
|
+
cellResults: result.cellResults.map(e => revive(e))
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
results: revivedResults,
|
|
120
|
+
limitHit: searchComplete.limitHit
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
if (data) {
|
|
125
|
+
disposables.add(this._notebookService.registerContributedNotebookType(viewType, data));
|
|
126
|
+
}
|
|
127
|
+
this._notebookSerializer.set(handle, disposables);
|
|
128
|
+
this._logService.trace("[NotebookSerializer] registered notebook serializer", {
|
|
129
|
+
viewType,
|
|
130
|
+
extensionId: extension.id.value
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
$unregisterNotebookSerializer(handle) {
|
|
134
|
+
this._notebookSerializer.get(handle)?.dispose();
|
|
135
|
+
this._notebookSerializer.delete(handle);
|
|
136
|
+
}
|
|
137
|
+
$emitCellStatusBarEvent(eventHandle) {
|
|
138
|
+
const emitter = this._notebookCellStatusBarRegistrations.get(eventHandle);
|
|
139
|
+
if (emitter instanceof Emitter) {
|
|
140
|
+
emitter.fire(undefined);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async $registerNotebookCellStatusBarItemProvider(handle, eventHandle, viewType) {
|
|
144
|
+
const that = this;
|
|
145
|
+
const provider = {
|
|
146
|
+
async provideCellStatusBarItems(uri, index, token) {
|
|
147
|
+
const result = await that._proxy.$provideNotebookCellStatusBarItems(handle, uri, index, token);
|
|
148
|
+
return {
|
|
149
|
+
items: result?.items ?? [],
|
|
150
|
+
dispose() {
|
|
151
|
+
if (result) {
|
|
152
|
+
that._proxy.$releaseNotebookCellStatusBarItems(result.cacheId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
viewType
|
|
158
|
+
};
|
|
159
|
+
if (typeof eventHandle === "number") {
|
|
160
|
+
const emitter = ( new Emitter());
|
|
161
|
+
this._notebookCellStatusBarRegistrations.set(eventHandle, emitter);
|
|
162
|
+
provider.onDidChangeStatusBarItems = emitter.event;
|
|
163
|
+
}
|
|
164
|
+
const disposable = this._cellStatusBarService.registerCellStatusBarItemProvider(provider);
|
|
165
|
+
this._notebookCellStatusBarRegistrations.set(handle, disposable);
|
|
166
|
+
}
|
|
167
|
+
async $unregisterNotebookCellStatusBarItemProvider(handle, eventHandle) {
|
|
168
|
+
const unregisterThing = handle => {
|
|
169
|
+
const entry = this._notebookCellStatusBarRegistrations.get(handle);
|
|
170
|
+
if (entry) {
|
|
171
|
+
this._notebookCellStatusBarRegistrations.get(handle)?.dispose();
|
|
172
|
+
this._notebookCellStatusBarRegistrations.delete(handle);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
unregisterThing(handle);
|
|
176
|
+
if (typeof eventHandle === "number") {
|
|
177
|
+
unregisterThing(eventHandle);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
MainThreadNotebooks = __decorate([extHostNamedCustomer(MainContext.MainThreadNotebook), ( __param(1, INotebookService)), ( __param(2, INotebookCellStatusBarService)), ( __param(3, ILogService))], MainThreadNotebooks);
|
|
182
|
+
CommandsRegistry.registerCommand("_executeDataToNotebook", async (accessor, ...args) => {
|
|
183
|
+
const [notebookType, bytes] = args;
|
|
184
|
+
assertType(typeof notebookType === "string", "string");
|
|
185
|
+
assertType(bytes instanceof VSBuffer, "VSBuffer");
|
|
186
|
+
const notebookService = accessor.get(INotebookService);
|
|
187
|
+
const info = await notebookService.withNotebookDataProvider(notebookType);
|
|
188
|
+
if (!(info instanceof SimpleNotebookProviderInfo)) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const dto = await info.serializer.dataToNotebook(bytes);
|
|
192
|
+
return ( new SerializableObjectWithBuffers(NotebookDto.toNotebookDataDto(dto)));
|
|
193
|
+
});
|
|
194
|
+
CommandsRegistry.registerCommand("_executeNotebookToData", async (accessor, notebookType, dto) => {
|
|
195
|
+
assertType(typeof notebookType === "string", "string");
|
|
196
|
+
const notebookService = accessor.get(INotebookService);
|
|
197
|
+
const info = await notebookService.withNotebookDataProvider(notebookType);
|
|
198
|
+
if (!(info instanceof SimpleNotebookProviderInfo)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const data = NotebookDto.fromNotebookDataDto(dto.value);
|
|
202
|
+
const bytes = await info.serializer.notebookToData(data);
|
|
203
|
+
return bytes;
|
|
204
|
+
});
|
|
205
|
+
function isFileOperationError(error) {
|
|
206
|
+
const candidate = error;
|
|
207
|
+
return typeof candidate?.fileOperationResult === "number" && typeof candidate?.message === "string";
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export { MainThreadNotebooks };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
+
import { NotebookTextModel } from "../../contrib/notebook/common/model/notebookTextModel.js";
|
|
3
|
+
import { INotebookEditorModelResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service";
|
|
4
|
+
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
5
|
+
import { MainThreadNotebookDocumentsShape, NotebookDataDto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
|
|
6
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
7
|
+
export declare class MainThreadNotebookDocuments implements MainThreadNotebookDocumentsShape {
|
|
8
|
+
private readonly _notebookEditorModelResolverService;
|
|
9
|
+
private readonly _uriIdentityService;
|
|
10
|
+
private readonly _disposables;
|
|
11
|
+
private readonly _proxy;
|
|
12
|
+
private readonly _documentEventListenersMapping;
|
|
13
|
+
private readonly _modelReferenceCollection;
|
|
14
|
+
constructor(extHostContext: IExtHostContext, _notebookEditorModelResolverService: INotebookEditorModelResolverService, _uriIdentityService: IUriIdentityService);
|
|
15
|
+
dispose(): void;
|
|
16
|
+
handleNotebooksAdded(notebooks: readonly NotebookTextModel[]): void;
|
|
17
|
+
handleNotebooksRemoved(uris: URI[]): void;
|
|
18
|
+
$tryCreateNotebook(options: {
|
|
19
|
+
viewType: string;
|
|
20
|
+
content?: NotebookDataDto;
|
|
21
|
+
}): Promise<UriComponents>;
|
|
22
|
+
$tryOpenNotebook(uriComponents: UriComponents): Promise<URI>;
|
|
23
|
+
$trySaveNotebook(uriComponents: UriComponents): Promise<boolean>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
+
import { DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
6
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
|
+
import { BoundModelReferenceCollection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/browser/mainThreadDocuments';
|
|
8
|
+
import { NotebookCellsChangeType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
|
+
import { INotebookEditorModelResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service';
|
|
10
|
+
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
11
|
+
import { ExtHostContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
|
|
12
|
+
import { NotebookDto } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/browser/mainThreadNotebookDto';
|
|
13
|
+
import { SerializableObjectWithBuffers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier';
|
|
14
|
+
|
|
15
|
+
let MainThreadNotebookDocuments = class MainThreadNotebookDocuments {
|
|
16
|
+
constructor(extHostContext, _notebookEditorModelResolverService, _uriIdentityService) {
|
|
17
|
+
this._notebookEditorModelResolverService = _notebookEditorModelResolverService;
|
|
18
|
+
this._uriIdentityService = _uriIdentityService;
|
|
19
|
+
this._disposables = ( new DisposableStore());
|
|
20
|
+
this._documentEventListenersMapping = ( new ResourceMap());
|
|
21
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookDocuments));
|
|
22
|
+
this._modelReferenceCollection = ( new BoundModelReferenceCollection(this._uriIdentityService.extUri));
|
|
23
|
+
this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(
|
|
24
|
+
model => this._proxy.$acceptDirtyStateChanged(model.resource, model.isDirty())
|
|
25
|
+
));
|
|
26
|
+
this._disposables.add(
|
|
27
|
+
this._notebookEditorModelResolverService.onDidSaveNotebook(e => this._proxy.$acceptModelSaved(e))
|
|
28
|
+
);
|
|
29
|
+
this._disposables.add(_notebookEditorModelResolverService.onWillFailWithConflict(e => {
|
|
30
|
+
this._modelReferenceCollection.remove(e.resource);
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
dispose() {
|
|
34
|
+
this._disposables.dispose();
|
|
35
|
+
this._modelReferenceCollection.dispose();
|
|
36
|
+
dispose(( this._documentEventListenersMapping.values()));
|
|
37
|
+
}
|
|
38
|
+
handleNotebooksAdded(notebooks) {
|
|
39
|
+
for (const textModel of notebooks) {
|
|
40
|
+
const disposableStore = ( new DisposableStore());
|
|
41
|
+
disposableStore.add(textModel.onDidChangeContent(event => {
|
|
42
|
+
const eventDto = {
|
|
43
|
+
versionId: event.versionId,
|
|
44
|
+
rawEvents: []
|
|
45
|
+
};
|
|
46
|
+
for (const e of event.rawEvents) {
|
|
47
|
+
switch (e.kind) {
|
|
48
|
+
case NotebookCellsChangeType.ModelChange:
|
|
49
|
+
eventDto.rawEvents.push({
|
|
50
|
+
kind: e.kind,
|
|
51
|
+
changes: e.changes.map(
|
|
52
|
+
diff => [diff[0], diff[1], diff[2].map(cell => NotebookDto.toNotebookCellDto(cell))]
|
|
53
|
+
)
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
case NotebookCellsChangeType.Move:
|
|
57
|
+
eventDto.rawEvents.push({
|
|
58
|
+
kind: e.kind,
|
|
59
|
+
index: e.index,
|
|
60
|
+
length: e.length,
|
|
61
|
+
newIdx: e.newIdx
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
case NotebookCellsChangeType.Output:
|
|
65
|
+
eventDto.rawEvents.push({
|
|
66
|
+
kind: e.kind,
|
|
67
|
+
index: e.index,
|
|
68
|
+
outputs: e.outputs.map(NotebookDto.toNotebookOutputDto)
|
|
69
|
+
});
|
|
70
|
+
break;
|
|
71
|
+
case NotebookCellsChangeType.OutputItem:
|
|
72
|
+
eventDto.rawEvents.push({
|
|
73
|
+
kind: e.kind,
|
|
74
|
+
index: e.index,
|
|
75
|
+
outputId: e.outputId,
|
|
76
|
+
outputItems: e.outputItems.map(NotebookDto.toNotebookOutputItemDto),
|
|
77
|
+
append: e.append
|
|
78
|
+
});
|
|
79
|
+
break;
|
|
80
|
+
case NotebookCellsChangeType.ChangeCellLanguage:
|
|
81
|
+
case NotebookCellsChangeType.ChangeCellContent:
|
|
82
|
+
case NotebookCellsChangeType.ChangeCellMetadata:
|
|
83
|
+
case NotebookCellsChangeType.ChangeCellInternalMetadata:
|
|
84
|
+
eventDto.rawEvents.push(e);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const hasDocumentMetadataChangeEvent = event.rawEvents.find(e => e.kind === NotebookCellsChangeType.ChangeDocumentMetadata);
|
|
89
|
+
this._proxy.$acceptModelChanged(textModel.uri, ( new SerializableObjectWithBuffers(eventDto)), this._notebookEditorModelResolverService.isDirty(textModel.uri), hasDocumentMetadataChangeEvent ? textModel.metadata : undefined);
|
|
90
|
+
}));
|
|
91
|
+
this._documentEventListenersMapping.set(textModel.uri, disposableStore);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
handleNotebooksRemoved(uris) {
|
|
95
|
+
for (const uri of uris) {
|
|
96
|
+
this._documentEventListenersMapping.get(uri)?.dispose();
|
|
97
|
+
this._documentEventListenersMapping.delete(uri);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async $tryCreateNotebook(options) {
|
|
101
|
+
if (options.content) {
|
|
102
|
+
const ref = await this._notebookEditorModelResolverService.resolve({
|
|
103
|
+
untitledResource: undefined
|
|
104
|
+
}, options.viewType);
|
|
105
|
+
Event.once(ref.object.notebook.onWillDispose)(() => {
|
|
106
|
+
ref.dispose();
|
|
107
|
+
});
|
|
108
|
+
this._proxy.$acceptDirtyStateChanged(ref.object.resource, true);
|
|
109
|
+
if (options.content) {
|
|
110
|
+
const data = NotebookDto.fromNotebookDataDto(options.content);
|
|
111
|
+
ref.object.notebook.reset(data.cells, data.metadata, ref.object.notebook.transientOptions);
|
|
112
|
+
}
|
|
113
|
+
return ref.object.notebook.uri;
|
|
114
|
+
} else {
|
|
115
|
+
const notebook = await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(options.viewType);
|
|
116
|
+
return notebook.uri;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async $tryOpenNotebook(uriComponents) {
|
|
120
|
+
const uri = URI.revive(uriComponents);
|
|
121
|
+
const ref = await this._notebookEditorModelResolverService.resolve(uri, undefined);
|
|
122
|
+
if (uriComponents.scheme === "untitled") {
|
|
123
|
+
ref.object.notebook.onWillDispose(() => {
|
|
124
|
+
ref.dispose();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
this._modelReferenceCollection.add(uri, ref);
|
|
128
|
+
return uri;
|
|
129
|
+
}
|
|
130
|
+
async $trySaveNotebook(uriComponents) {
|
|
131
|
+
const uri = URI.revive(uriComponents);
|
|
132
|
+
const ref = await this._notebookEditorModelResolverService.resolve(uri);
|
|
133
|
+
const saveResult = await ref.object.save();
|
|
134
|
+
ref.dispose();
|
|
135
|
+
return saveResult;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
MainThreadNotebookDocuments = ( __decorate([( __param(1, INotebookEditorModelResolverService)), ( __param(2, IUriIdentityService))], MainThreadNotebookDocuments));
|
|
139
|
+
|
|
140
|
+
export { MainThreadNotebookDocuments };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
2
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
3
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
4
|
+
import { INotebookEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service";
|
|
5
|
+
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
6
|
+
import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
|
|
7
|
+
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
8
|
+
export declare class MainThreadNotebooksAndEditors {
|
|
9
|
+
private readonly _notebookService;
|
|
10
|
+
private readonly _notebookEditorService;
|
|
11
|
+
private readonly _editorService;
|
|
12
|
+
private readonly _editorGroupService;
|
|
13
|
+
private readonly _logService;
|
|
14
|
+
private readonly _proxy;
|
|
15
|
+
private readonly _disposables;
|
|
16
|
+
private readonly _editorListeners;
|
|
17
|
+
private _currentState?;
|
|
18
|
+
private readonly _mainThreadNotebooks;
|
|
19
|
+
private readonly _mainThreadEditors;
|
|
20
|
+
constructor(extHostContext: IExtHostContext, instantiationService: IInstantiationService, _notebookService: INotebookService, _notebookEditorService: INotebookEditorService, _editorService: IEditorService, _editorGroupService: IEditorGroupsService, _logService: ILogService);
|
|
21
|
+
dispose(): void;
|
|
22
|
+
private _handleEditorAdd;
|
|
23
|
+
private _handleEditorRemove;
|
|
24
|
+
private _updateState;
|
|
25
|
+
private _onDelta;
|
|
26
|
+
private static _isDeltaEmpty;
|
|
27
|
+
private static _asModelAddData;
|
|
28
|
+
private _asEditorAddData;
|
|
29
|
+
}
|