@theia/plugin-ext 1.40.1 → 1.41.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/lib/common/collections.d.ts +4 -0
- package/lib/common/collections.d.ts.map +1 -1
- package/lib/common/collections.js +17 -1
- package/lib/common/collections.js.map +1 -1
- package/lib/common/errors.d.ts +14 -0
- package/lib/common/errors.d.ts.map +1 -1
- package/lib/common/errors.js +17 -1
- package/lib/common/errors.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +286 -6
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +20 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +27 -5
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +5 -2
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +21 -12
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/plugin-reader.d.ts +1 -1
- package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-reader.js +1 -1
- package/lib/hosted/node/plugin-reader.js.map +1 -1
- package/lib/hosted/node/scanners/grammars-reader.d.ts +1 -1
- package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
- package/lib/hosted/node/scanners/grammars-reader.js +5 -5
- package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +6 -6
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +54 -41
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.d.ts +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.js +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +1 -0
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +6 -4
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.d.ts.map +1 -1
- package/lib/main/browser/main-context.js +18 -0
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts +50 -0
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +189 -0
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -0
- package/lib/main/browser/notebooks/notebook-documents-main.d.ts +22 -0
- package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-documents-main.js +133 -0
- package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -0
- package/lib/main/browser/notebooks/notebook-dto.d.ts +15 -0
- package/lib/main/browser/notebooks/notebook-dto.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-dto.js +138 -0
- package/lib/main/browser/notebooks/notebook-dto.js.map +1 -0
- package/lib/main/browser/notebooks/notebook-editors-main.d.ts +20 -0
- package/lib/main/browser/notebooks/notebook-editors-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-editors-main.js +58 -0
- package/lib/main/browser/notebooks/notebook-editors-main.js.map +1 -0
- package/lib/main/browser/notebooks/notebook-kernels-main.d.ts +42 -0
- package/lib/main/browser/notebooks/notebook-kernels-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-kernels-main.js +230 -0
- package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -0
- package/lib/main/browser/notebooks/notebook-renderers-main.d.ts +12 -0
- package/lib/main/browser/notebooks/notebook-renderers-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebook-renderers-main.js +39 -0
- package/lib/main/browser/notebooks/notebook-renderers-main.js.map +1 -0
- package/lib/main/browser/notebooks/notebooks-main.d.ts +20 -0
- package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -0
- package/lib/main/browser/notebooks/notebooks-main.js +103 -0
- package/lib/main/browser/notebooks/notebooks-main.js.map +1 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +35 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +204 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -0
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts +13 -0
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -0
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js +375 -0
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -0
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +52 -0
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -0
- package/{src/typings/index.d.ts → lib/main/browser/notebooks/renderers/webview-communication.js} +8 -11
- package/lib/main/browser/notebooks/renderers/webview-communication.js.map +1 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts +3 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.js +31 -3
- package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +3 -2
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
- package/lib/main/browser/plugin-icon-theme-service.js +6 -0
- package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +2 -1
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/tasks-main.js +2 -2
- package/lib/main/browser/tasks-main.js.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +2 -2
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +4 -4
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +3 -1
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +32 -1
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-views-main.d.ts +2 -1
- package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
- package/lib/main/browser/view/tree-views-main.js +10 -0
- package/lib/main/browser/view/tree-views-main.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -0
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +5 -0
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/main/node/errors.spec.d.ts +2 -0
- package/lib/main/node/errors.spec.d.ts.map +1 -0
- package/lib/main/node/errors.spec.js +36 -0
- package/lib/main/node/errors.spec.js.map +1 -0
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +5 -2
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.js +14 -8
- package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +2 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js +13 -5
- package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
- package/lib/main/node/paths/plugin-paths-service.d.ts.map +1 -1
- package/lib/main/node/paths/plugin-paths-service.js +4 -9
- package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +8 -8
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
- package/lib/main/node/plugin-deployer-entry-impl.d.ts +2 -2
- package/lib/main/node/plugin-deployer-entry-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-entry-impl.js +9 -7
- package/lib/main/node/plugin-deployer-entry-impl.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts +2 -2
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +16 -24
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts +2 -2
- package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-github-resolver.d.ts.map +1 -1
- package/lib/main/node/plugin-github-resolver.js +14 -6
- package/lib/main/node/plugin-github-resolver.js.map +1 -1
- package/lib/main/node/plugin-http-resolver.d.ts.map +1 -1
- package/lib/main/node/plugin-http-resolver.js +14 -6
- package/lib/main/node/plugin-http-resolver.js.map +1 -1
- package/lib/main/node/temp-dir-util.d.ts +1 -0
- package/lib/main/node/temp-dir-util.d.ts.map +1 -1
- package/lib/main/node/temp-dir-util.js +12 -3
- package/lib/main/node/temp-dir-util.js.map +1 -1
- package/lib/plugin/editors-and-documents.d.ts +1 -1
- package/lib/plugin/editors-and-documents.d.ts.map +1 -1
- package/lib/plugin/editors-and-documents.js +1 -1
- package/lib/plugin/editors-and-documents.js.map +1 -1
- package/lib/plugin/notebook/notebook-document.d.ts +62 -0
- package/lib/plugin/notebook/notebook-document.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-document.js +373 -0
- package/lib/plugin/notebook/notebook-document.js.map +1 -0
- package/lib/plugin/notebook/notebook-documents.d.ts +17 -0
- package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-documents.js +48 -0
- package/lib/plugin/notebook/notebook-documents.js.map +1 -0
- package/lib/plugin/notebook/notebook-editor.d.ts +21 -0
- package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-editor.js +99 -0
- package/lib/plugin/notebook/notebook-editor.js.map +1 -0
- package/lib/plugin/notebook/notebook-editors.d.ts +14 -0
- package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-editors.js +65 -0
- package/lib/plugin/notebook/notebook-editors.js.map +1 -0
- package/lib/plugin/notebook/notebook-kernels.d.ts +37 -0
- package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-kernels.js +516 -0
- package/lib/plugin/notebook/notebook-kernels.js.map +1 -0
- package/lib/plugin/notebook/notebook-renderers.d.ts +14 -0
- package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -0
- package/lib/plugin/notebook/notebook-renderers.js +63 -0
- package/lib/plugin/notebook/notebook-renderers.js.map +1 -0
- package/lib/plugin/notebook/notebooks.d.ts +57 -0
- package/lib/plugin/notebook/notebooks.d.ts.map +1 -0
- package/lib/plugin/notebook/notebooks.js +295 -0
- package/lib/plugin/notebook/notebooks.js.map +1 -0
- package/lib/plugin/plugin-context.d.ts +2 -2
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +79 -59
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +9 -1
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/tasks/task-provider.d.ts +2 -2
- package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
- package/lib/plugin/tasks/task-provider.js +7 -10
- package/lib/plugin/tasks/task-provider.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +3 -2
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +18 -13
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +3 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +11 -1
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/tree/tree-views.d.ts +15 -5
- package/lib/plugin/tree/tree-views.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.js +52 -3
- package/lib/plugin/tree/tree-views.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +60 -0
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +372 -13
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +68 -29
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +123 -44
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +31 -29
- package/src/common/collections.ts +17 -0
- package/src/common/errors.ts +26 -0
- package/src/common/plugin-api-rpc.ts +340 -5
- package/src/common/plugin-protocol.ts +23 -5
- package/src/hosted/browser/hosted-plugin.ts +21 -14
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -1
- package/src/hosted/node/plugin-reader.ts +1 -1
- package/src/hosted/node/scanners/grammars-reader.ts +6 -5
- package/src/hosted/node/scanners/scanner-theia.ts +55 -41
- package/src/main/browser/custom-editors/custom-editor-widget.ts +1 -1
- package/src/main/browser/custom-editors/custom-editors-main.ts +1 -1
- package/src/main/browser/editors-and-documents-main.ts +1 -0
- package/src/main/browser/languages-main.ts +7 -4
- package/src/main/browser/main-context.ts +19 -0
- package/src/main/browser/menus/menus-contribution-handler.ts +7 -4
- package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +238 -0
- package/src/main/browser/notebooks/notebook-documents-main.ts +166 -0
- package/src/main/browser/notebooks/notebook-dto.ts +141 -0
- package/src/main/browser/notebooks/notebook-editors-main.ts +70 -0
- package/src/main/browser/notebooks/notebook-kernels-main.ts +291 -0
- package/src/main/browser/notebooks/notebook-renderers-main.ts +47 -0
- package/src/main/browser/notebooks/notebooks-main.ts +124 -0
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +198 -0
- package/src/main/browser/notebooks/renderers/output-webview-internal.ts +476 -0
- package/src/main/browser/notebooks/renderers/webview-communication.ts +79 -0
- package/src/main/browser/plugin-contribution-handler.ts +36 -3
- package/src/main/browser/plugin-ext-frontend-module.ts +7 -3
- package/src/main/browser/plugin-icon-theme-service.ts +6 -0
- package/src/main/browser/plugin-shared-style.ts +2 -1
- package/src/main/browser/tasks-main.ts +4 -4
- package/src/main/browser/terminal-main.ts +5 -5
- package/src/main/browser/view/tree-view-widget.tsx +36 -2
- package/src/main/browser/view/tree-views-main.ts +8 -0
- package/src/main/browser/webview/webview.ts +6 -0
- package/src/main/node/errors.spec.ts +37 -0
- package/src/main/node/handlers/plugin-theia-directory-handler.ts +18 -8
- package/src/main/node/handlers/plugin-theia-file-handler.ts +18 -6
- package/src/main/node/paths/plugin-paths-service.ts +5 -10
- package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +8 -8
- package/src/main/node/plugin-deployer-entry-impl.ts +9 -7
- package/src/main/node/plugin-deployer-impl.ts +20 -28
- package/src/main/node/plugin-deployer-proxy-entry-impl.ts +2 -2
- package/src/main/node/plugin-github-resolver.ts +15 -8
- package/src/main/node/plugin-http-resolver.ts +15 -8
- package/src/main/node/temp-dir-util.ts +11 -2
- package/src/plugin/editors-and-documents.ts +1 -1
- package/src/plugin/notebook/notebook-document.ts +438 -0
- package/src/plugin/notebook/notebook-documents.ts +58 -0
- package/src/plugin/notebook/notebook-editor.ts +116 -0
- package/src/plugin/notebook/notebook-editors.ts +71 -0
- package/src/plugin/notebook/notebook-kernels.ts +616 -0
- package/src/plugin/notebook/notebook-renderers.ts +72 -0
- package/src/plugin/notebook/notebooks.ts +385 -0
- package/src/plugin/plugin-context.ts +77 -70
- package/src/plugin/plugin-manager.ts +9 -1
- package/src/plugin/tasks/task-provider.ts +9 -12
- package/src/plugin/tasks/tasks.ts +18 -13
- package/src/plugin/terminal-ext.ts +13 -1
- package/src/plugin/tree/tree-views.ts +57 -7
- package/src/plugin/type-converters.ts +370 -12
- package/src/plugin/types-impl.ts +162 -58
- package/lib/main/browser/custom-editors/undo-redo-service.d.ts +0 -24
- package/lib/main/browser/custom-editors/undo-redo-service.d.ts.map +0 -1
- package/lib/main/browser/custom-editors/undo-redo-service.js +0 -111
- package/lib/main/browser/custom-editors/undo-redo-service.js.map +0 -1
- package/src/main/browser/custom-editors/undo-redo-service.ts +0 -120
|
@@ -28,7 +28,12 @@ import * as types from './types-impl';
|
|
|
28
28
|
import { UriComponents } from '../common/uri-components';
|
|
29
29
|
import { isReadonlyArray } from '../common/arrays';
|
|
30
30
|
import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/markdown-rendering';
|
|
31
|
-
import { isObject } from '@theia/core/lib/common';
|
|
31
|
+
import { DisposableCollection, isEmptyObject, isObject } from '@theia/core/lib/common';
|
|
32
|
+
import * as notebooks from '@theia/notebook/lib/common';
|
|
33
|
+
import { CommandsConverter } from './command-registry';
|
|
34
|
+
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
35
|
+
import { CellData, CellExecutionUpdateType, CellOutput, CellOutputItem, CellRange, isTextStreamMime } from '@theia/notebook/lib/common';
|
|
36
|
+
import { CellExecuteUpdate, CellExecutionComplete } from '@theia/notebook/lib/browser';
|
|
32
37
|
|
|
33
38
|
const SIDE_GROUP = -2;
|
|
34
39
|
const ACTIVE_GROUP = -1;
|
|
@@ -201,6 +206,16 @@ export function fromMarkdown(markup: theia.MarkdownString | theia.MarkedString):
|
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
208
|
|
|
209
|
+
export function fromMarkdownOrString(value: string | theia.MarkdownString | undefined): string | MarkdownStringDTO | undefined {
|
|
210
|
+
if (value === undefined) {
|
|
211
|
+
return undefined;
|
|
212
|
+
} else if (typeof value === 'string') {
|
|
213
|
+
return value;
|
|
214
|
+
} else {
|
|
215
|
+
return fromMarkdown(value);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
204
219
|
export function toMarkdown(value: MarkdownStringDTO): PluginMarkdownStringImpl {
|
|
205
220
|
const implemented = new PluginMarkdownStringImpl(value.value, value.supportThemeIcons);
|
|
206
221
|
implemented.isTrusted = value.isTrusted;
|
|
@@ -571,26 +586,46 @@ export function fromWorkspaceEdit(value: theia.WorkspaceEdit, documents?: any):
|
|
|
571
586
|
edits: []
|
|
572
587
|
};
|
|
573
588
|
for (const entry of (value as types.WorkspaceEdit)._allEntries()) {
|
|
574
|
-
|
|
575
|
-
if (Array.isArray(uriOrEdits)) {
|
|
589
|
+
if (entry?._type === types.FileEditType.Text) {
|
|
576
590
|
// text edits
|
|
577
|
-
const doc = documents ? documents.getDocument(uri.toString()) : undefined;
|
|
591
|
+
const doc = documents ? documents.getDocument(entry.uri.toString()) : undefined;
|
|
578
592
|
const workspaceTextEditDto: WorkspaceTextEditDto = {
|
|
579
|
-
resource: uri,
|
|
593
|
+
resource: entry.uri,
|
|
580
594
|
modelVersionId: doc?.version,
|
|
581
|
-
textEdit:
|
|
582
|
-
metadata: entry
|
|
595
|
+
textEdit: (entry.edit instanceof types.TextEdit) ? fromTextEdit(entry.edit) : fromSnippetTextEdit(entry.edit),
|
|
596
|
+
metadata: entry.metadata
|
|
583
597
|
};
|
|
584
598
|
result.edits.push(workspaceTextEditDto);
|
|
585
|
-
} else {
|
|
599
|
+
} else if (entry?._type === types.FileEditType.File) {
|
|
586
600
|
// resource edits
|
|
587
601
|
const workspaceFileEditDto: WorkspaceFileEditDto = {
|
|
588
|
-
oldResource:
|
|
589
|
-
newResource:
|
|
590
|
-
options: entry
|
|
591
|
-
metadata: entry
|
|
602
|
+
oldResource: entry.from,
|
|
603
|
+
newResource: entry.to,
|
|
604
|
+
options: entry.options,
|
|
605
|
+
metadata: entry.metadata
|
|
592
606
|
};
|
|
593
607
|
result.edits.push(workspaceFileEditDto);
|
|
608
|
+
} else if (entry?._type === types.FileEditType.Cell) {
|
|
609
|
+
// cell edit
|
|
610
|
+
if (entry.edit) {
|
|
611
|
+
result.edits.push({
|
|
612
|
+
metadata: entry.metadata,
|
|
613
|
+
resource: entry.uri,
|
|
614
|
+
cellEdit: entry.edit,
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
} else if (entry?._type === types.FileEditType.CellReplace) {
|
|
618
|
+
// cell replace
|
|
619
|
+
result.edits.push({
|
|
620
|
+
metadata: entry.metadata,
|
|
621
|
+
resource: entry.uri,
|
|
622
|
+
cellEdit: {
|
|
623
|
+
editType: notebooks.CellEditType.Replace,
|
|
624
|
+
index: entry.index,
|
|
625
|
+
count: entry.count,
|
|
626
|
+
cells: entry.cells.map(NotebookCellData.from)
|
|
627
|
+
}
|
|
628
|
+
});
|
|
594
629
|
}
|
|
595
630
|
}
|
|
596
631
|
return result;
|
|
@@ -1387,3 +1422,326 @@ export namespace DataTransfer {
|
|
|
1387
1422
|
return dataTransfer;
|
|
1388
1423
|
}
|
|
1389
1424
|
}
|
|
1425
|
+
|
|
1426
|
+
export namespace NotebookDocumentContentOptions {
|
|
1427
|
+
export function from(options: theia.NotebookDocumentContentOptions | undefined): notebooks.TransientOptions {
|
|
1428
|
+
return {
|
|
1429
|
+
transientOutputs: options?.transientOutputs ?? false,
|
|
1430
|
+
transientCellMetadata: options?.transientCellMetadata ?? {},
|
|
1431
|
+
transientDocumentMetadata: options?.transientDocumentMetadata ?? {},
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
export namespace NotebookStatusBarItem {
|
|
1437
|
+
export function from(item: theia.NotebookCellStatusBarItem, commandsConverter: CommandsConverter, disposables: DisposableCollection): notebooks.NotebookCellStatusBarItem {
|
|
1438
|
+
const command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;
|
|
1439
|
+
return {
|
|
1440
|
+
alignment: item.alignment === types.NotebookCellStatusBarAlignment.Left ? notebooks.CellStatusbarAlignment.Left : notebooks.CellStatusbarAlignment.Right,
|
|
1441
|
+
command: commandsConverter.toSafeCommand(command, disposables),
|
|
1442
|
+
text: item.text,
|
|
1443
|
+
tooltip: item.tooltip,
|
|
1444
|
+
priority: item.priority
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
export namespace NotebookData {
|
|
1450
|
+
|
|
1451
|
+
export function from(data: theia.NotebookData): rpc.NotebookDataDto {
|
|
1452
|
+
const res: rpc.NotebookDataDto = {
|
|
1453
|
+
metadata: data.metadata ?? Object.create(null),
|
|
1454
|
+
cells: [],
|
|
1455
|
+
};
|
|
1456
|
+
for (const cell of data.cells) {
|
|
1457
|
+
// types.NotebookCellData.validate(cell);
|
|
1458
|
+
res.cells.push(NotebookCellData.from(cell));
|
|
1459
|
+
}
|
|
1460
|
+
return res;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
export function to(data: rpc.NotebookDataDto): theia.NotebookData {
|
|
1464
|
+
const res = new types.NotebookData(
|
|
1465
|
+
data.cells.map(NotebookCellData.to),
|
|
1466
|
+
);
|
|
1467
|
+
if (!isEmptyObject(data.metadata)) {
|
|
1468
|
+
res.metadata = data.metadata;
|
|
1469
|
+
}
|
|
1470
|
+
return res;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
export namespace NotebookCellData {
|
|
1475
|
+
|
|
1476
|
+
export function from(data: theia.NotebookCellData): rpc.NotebookCellDataDto {
|
|
1477
|
+
return {
|
|
1478
|
+
cellKind: NotebookCellKind.from(data.kind),
|
|
1479
|
+
language: data.languageId,
|
|
1480
|
+
source: data.value,
|
|
1481
|
+
// metadata: data.metadata,
|
|
1482
|
+
// internalMetadata: NotebookCellExecutionSummary.from(data.executionSummary ?? {}),
|
|
1483
|
+
outputs: data.outputs ? data.outputs.map(NotebookCellOutputConverter.from) : []
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
export function to(data: rpc.NotebookCellDataDto): theia.NotebookCellData {
|
|
1488
|
+
return new types.NotebookCellData(
|
|
1489
|
+
NotebookCellKind.to(data.cellKind),
|
|
1490
|
+
data.source,
|
|
1491
|
+
data.language,
|
|
1492
|
+
data.outputs ? data.outputs.map(NotebookCellOutput.to) : undefined,
|
|
1493
|
+
data.metadata,
|
|
1494
|
+
data.internalMetadata ? NotebookCellExecutionSummary.to(data.internalMetadata) : undefined
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
export namespace NotebookCellKind {
|
|
1500
|
+
export function from(data: theia.NotebookCellKind): notebooks.CellKind {
|
|
1501
|
+
switch (data) {
|
|
1502
|
+
case types.NotebookCellKind.Markup:
|
|
1503
|
+
return notebooks.CellKind.Markup;
|
|
1504
|
+
case types.NotebookCellKind.Code:
|
|
1505
|
+
default:
|
|
1506
|
+
return notebooks.CellKind.Code;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
export function to(data: notebooks.CellKind): theia.NotebookCellKind {
|
|
1511
|
+
switch (data) {
|
|
1512
|
+
case notebooks.CellKind.Markup:
|
|
1513
|
+
return types.NotebookCellKind.Markup;
|
|
1514
|
+
case notebooks.CellKind.Code:
|
|
1515
|
+
default:
|
|
1516
|
+
return types.NotebookCellKind.Code;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
export namespace NotebookCellOutput {
|
|
1522
|
+
export function from(output: theia.NotebookCellOutput & { outputId: string }): rpc.NotebookOutputDto {
|
|
1523
|
+
return {
|
|
1524
|
+
outputId: output.outputId,
|
|
1525
|
+
items: output.items.map(NotebookCellOutputItem.from),
|
|
1526
|
+
metadata: output.metadata
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
export function to(output: rpc.NotebookOutputDto): theia.NotebookCellOutput {
|
|
1531
|
+
const items = output.items.map(NotebookCellOutputItem.to);
|
|
1532
|
+
return new types.NotebookCellOutput(items, output.outputId, output.metadata);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
export namespace NotebookCellOutputItem {
|
|
1537
|
+
export function from(item: types.NotebookCellOutputItem): rpc.NotebookOutputItemDto {
|
|
1538
|
+
return {
|
|
1539
|
+
mime: item.mime,
|
|
1540
|
+
valueBytes: BinaryBuffer.wrap(item.data),
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
export function to(item: rpc.NotebookOutputItemDto): types.NotebookCellOutputItem {
|
|
1545
|
+
return new types.NotebookCellOutputItem(item.valueBytes.buffer, item.mime);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
export namespace NotebookCellOutputConverter {
|
|
1550
|
+
export function from(output: types.NotebookCellOutput): rpc.NotebookOutputDto {
|
|
1551
|
+
return {
|
|
1552
|
+
outputId: output.outputId,
|
|
1553
|
+
items: output.items.map(NotebookCellOutputItem.from),
|
|
1554
|
+
metadata: output.metadata
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
export function to(output: rpc.NotebookOutputDto): types.NotebookCellOutput {
|
|
1559
|
+
const items = output.items.map(NotebookCellOutputItem.to);
|
|
1560
|
+
return new types.NotebookCellOutput(items, output.outputId, output.metadata);
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
export function ensureUniqueMimeTypes(items: types.NotebookCellOutputItem[], warn: boolean = false): types.NotebookCellOutputItem[] {
|
|
1564
|
+
const seen = new Set<string>();
|
|
1565
|
+
const removeIdx = new Set<number>();
|
|
1566
|
+
for (let i = 0; i < items.length; i++) {
|
|
1567
|
+
const item = items[i];
|
|
1568
|
+
// We can have multiple text stream mime types in the same output.
|
|
1569
|
+
if (!seen.has(item.mime) || isTextStreamMime(item.mime)) {
|
|
1570
|
+
seen.add(item.mime);
|
|
1571
|
+
continue;
|
|
1572
|
+
}
|
|
1573
|
+
// duplicated mime types... first has won
|
|
1574
|
+
removeIdx.add(i);
|
|
1575
|
+
if (warn) {
|
|
1576
|
+
console.warn(`DUPLICATED mime type '${item.mime}' will be dropped`);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
if (removeIdx.size === 0) {
|
|
1580
|
+
return items;
|
|
1581
|
+
}
|
|
1582
|
+
return items.filter((_, index) => !removeIdx.has(index));
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
export namespace NotebookCellExecutionSummary {
|
|
1587
|
+
export function to(data: notebooks.NotebookCellInternalMetadata): theia.NotebookCellExecutionSummary {
|
|
1588
|
+
return {
|
|
1589
|
+
timing: typeof data.runStartTime === 'number' && typeof data.runEndTime === 'number' ? { startTime: data.runStartTime, endTime: data.runEndTime } : undefined,
|
|
1590
|
+
executionOrder: data.executionOrder,
|
|
1591
|
+
success: data.lastRunSuccess
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
export function from(data: theia.NotebookCellExecutionSummary): Partial<notebooks.NotebookCellInternalMetadata> {
|
|
1596
|
+
return {
|
|
1597
|
+
lastRunSuccess: data.success,
|
|
1598
|
+
runStartTime: data.timing?.startTime,
|
|
1599
|
+
runEndTime: data.timing?.endTime,
|
|
1600
|
+
executionOrder: data.executionOrder
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
export namespace NotebookRange {
|
|
1606
|
+
|
|
1607
|
+
export function from(range: theia.NotebookRange): CellRange {
|
|
1608
|
+
return { start: range.start, end: range.end };
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
export function to(range: CellRange): types.NotebookRange {
|
|
1612
|
+
return new types.NotebookRange(range.start, range.end);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
export namespace NotebookKernelSourceAction {
|
|
1617
|
+
export function from(item: theia.NotebookKernelSourceAction, commandsConverter: CommandsConverter, disposables: DisposableCollection): rpc.NotebookKernelSourceActionDto {
|
|
1618
|
+
const command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;
|
|
1619
|
+
|
|
1620
|
+
return {
|
|
1621
|
+
command: commandsConverter.toSafeCommand(command, disposables),
|
|
1622
|
+
label: item.label,
|
|
1623
|
+
description: item.description,
|
|
1624
|
+
detail: item.detail,
|
|
1625
|
+
documentation: item.documentation
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
export namespace NotebookDto {
|
|
1631
|
+
|
|
1632
|
+
export function toNotebookOutputItemDto(item: CellOutputItem): rpc.NotebookOutputItemDto {
|
|
1633
|
+
return {
|
|
1634
|
+
mime: item.mime,
|
|
1635
|
+
valueBytes: item.data
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
export function toNotebookOutputDto(output: CellOutput): rpc.NotebookOutputDto {
|
|
1640
|
+
return {
|
|
1641
|
+
outputId: output.outputId,
|
|
1642
|
+
metadata: output.metadata,
|
|
1643
|
+
items: output.outputs.map(toNotebookOutputItemDto)
|
|
1644
|
+
};
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
export function toNotebookCellDataDto(cell: CellData): rpc.NotebookCellDataDto {
|
|
1648
|
+
return {
|
|
1649
|
+
cellKind: cell.cellKind,
|
|
1650
|
+
language: cell.language,
|
|
1651
|
+
source: cell.source,
|
|
1652
|
+
internalMetadata: cell.internalMetadata,
|
|
1653
|
+
metadata: cell.metadata,
|
|
1654
|
+
outputs: cell.outputs.map(toNotebookOutputDto)
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
// export function toNotebookDataDto(data: NotebookData): rpc.NotebookDataDto {
|
|
1659
|
+
// return {
|
|
1660
|
+
// metadata: data.metadata,
|
|
1661
|
+
// cells: data.cells.map(toNotebookCellDataDto)
|
|
1662
|
+
// };
|
|
1663
|
+
// }
|
|
1664
|
+
|
|
1665
|
+
export function fromNotebookOutputItemDto(item: rpc.NotebookOutputItemDto): CellOutputItem {
|
|
1666
|
+
return {
|
|
1667
|
+
mime: item.mime,
|
|
1668
|
+
data: item.valueBytes
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
export function fromNotebookOutputDto(output: rpc.NotebookOutputDto): CellOutput {
|
|
1673
|
+
return {
|
|
1674
|
+
outputId: output.outputId,
|
|
1675
|
+
metadata: output.metadata,
|
|
1676
|
+
outputs: output.items.map(fromNotebookOutputItemDto)
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
export function fromNotebookCellDataDto(cell: rpc.NotebookCellDataDto): CellData {
|
|
1681
|
+
return {
|
|
1682
|
+
cellKind: cell.cellKind,
|
|
1683
|
+
language: cell.language,
|
|
1684
|
+
source: cell.source,
|
|
1685
|
+
outputs: cell.outputs.map(fromNotebookOutputDto),
|
|
1686
|
+
metadata: cell.metadata,
|
|
1687
|
+
internalMetadata: cell.internalMetadata
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// export function fromNotebookDataDto(data: rpc.NotebookDataDto): NotebookData {
|
|
1692
|
+
// return {
|
|
1693
|
+
// metadata: data.metadata,
|
|
1694
|
+
// cells: data.cells.map(fromNotebookCellDataDto)
|
|
1695
|
+
// };
|
|
1696
|
+
// }
|
|
1697
|
+
|
|
1698
|
+
// export function toNotebookCellDto(cell: Cell): rpc.NotebookCellDto {
|
|
1699
|
+
// return {
|
|
1700
|
+
// handle: cell.handle,
|
|
1701
|
+
// uri: cell.uri,
|
|
1702
|
+
// source: cell.textBuffer.getLinesContent(),
|
|
1703
|
+
// eol: cell.textBuffer.getEOL(),
|
|
1704
|
+
// language: cell.language,
|
|
1705
|
+
// cellKind: cell.cellKind,
|
|
1706
|
+
// outputs: cell.outputs.map(toNotebookOutputDto),
|
|
1707
|
+
// metadata: cell.metadata,
|
|
1708
|
+
// internalMetadata: cell.internalMetadata,
|
|
1709
|
+
// };
|
|
1710
|
+
// }
|
|
1711
|
+
|
|
1712
|
+
export function fromCellExecuteUpdateDto(data: rpc.CellExecuteUpdateDto): CellExecuteUpdate {
|
|
1713
|
+
if (data.editType === CellExecutionUpdateType.Output) {
|
|
1714
|
+
return {
|
|
1715
|
+
editType: data.editType,
|
|
1716
|
+
cellHandle: data.cellHandle,
|
|
1717
|
+
append: data.append,
|
|
1718
|
+
outputs: data.outputs.map(fromNotebookOutputDto)
|
|
1719
|
+
};
|
|
1720
|
+
} else if (data.editType === CellExecutionUpdateType.OutputItems) {
|
|
1721
|
+
return {
|
|
1722
|
+
editType: data.editType,
|
|
1723
|
+
append: data.append,
|
|
1724
|
+
items: data.items.map(fromNotebookOutputItemDto)
|
|
1725
|
+
};
|
|
1726
|
+
} else {
|
|
1727
|
+
return data;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
export function fromCellExecuteCompleteDto(data: rpc.CellExecutionCompleteDto): CellExecutionComplete {
|
|
1732
|
+
return data;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
// export function fromCellEditOperationDto(edit: rpc.CellEditOperationDto): CellEditOperation {
|
|
1736
|
+
// if (edit.editType === CellEditType.Replace) {
|
|
1737
|
+
// return {
|
|
1738
|
+
// editType: edit.editType,
|
|
1739
|
+
// index: edit.index,
|
|
1740
|
+
// count: edit.count,
|
|
1741
|
+
// cells: edit.cells.map(fromNotebookCellDataDto)
|
|
1742
|
+
// };
|
|
1743
|
+
// } else {
|
|
1744
|
+
// return edit;
|
|
1745
|
+
// }
|
|
1746
|
+
// }
|
|
1747
|
+
}
|