提交 5024a705 编写于 作者: R rebornix

convert output exthost/main. not optimized.

上级 0a972947
......@@ -45,23 +45,23 @@ if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
:: Tests in the extension host
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test\unit --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test\unit --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%
@REM call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .
@REM if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-notebook-tests\test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-notebook-tests --extensionTestsPath=%~dp0\..\extensions\vscode-notebook-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
......
......@@ -51,7 +51,7 @@ import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService';
import { TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions } from 'vs/platform/remote/common/tunnel';
import { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProviderDescriptor, InternalTimelineOptions } from 'vs/workbench/contrib/timeline/common/timeline';
import { revive } from 'vs/base/common/marshalling';
import { IDisplayOutputDto, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { Dto } from 'vs/base/common/types';
import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable';
......@@ -744,7 +744,7 @@ export interface ICellDto {
source: string[];
language: string;
cellKind: CellKind;
outputs: IDisplayOutputDto[];
outputs: IOutputDto[];
metadata?: NotebookCellMetadata;
}
......@@ -757,7 +757,7 @@ export type NotebookCellsSplice = [
export type NotebookCellOutputsSplice = [
number /* start */,
number /* delete count */,
IDisplayOutputDto[]
IOutputDto[]
];
export enum NotebookEditorRevealType {
......
......@@ -13,7 +13,7 @@ import { URI } from 'vs/base/common/uri';
import { CellKind, INotebookDocumentPropertiesChangeData, IWorkspaceCellEditDto, MainThreadBulkEditsShape, MainThreadNotebookShape, WorkspaceEditType } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostDocumentsAndEditors, IExtHostModelAddedData } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { NotebookCellOutput } from 'vs/workbench/api/common/extHostTypes';
import { CellEditType, IMainCellDto, IDisplayOutputDto, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookCellsSplice2, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellEditType, IMainCellDto, IOutputDto, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookCellsSplice2, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import * as vscode from 'vscode';
......@@ -69,10 +69,10 @@ export class ExtHostCell extends Disposable {
private _onDidDispose = new Emitter<void>();
readonly onDidDispose: Event<void> = this._onDidDispose.event;
private _onDidChangeOutputs = new Emitter<ISplice<IDisplayOutputDto>[]>();
readonly onDidChangeOutputs: Event<ISplice<IDisplayOutputDto>[]> = this._onDidChangeOutputs.event;
private _onDidChangeOutputs = new Emitter<ISplice<IOutputDto>[]>();
readonly onDidChangeOutputs: Event<ISplice<IOutputDto>[]> = this._onDidChangeOutputs.event;
private _outputs: IDisplayOutputDto[];
private _outputs: IOutputDto[];
private _metadata: vscode.NotebookCellMetadata;
......@@ -114,14 +114,10 @@ export class ExtHostCell extends Disposable {
document: data.document,
get language() { return data!.document.languageId; },
get outputs() {
return that._outputs.map(ouptput => {
const copy: vscode.CellOutput & { outputId?: string } = { ...ouptput };
delete copy.outputId;
return copy;
});
return that._outputs.map(output => NotebookCellOutput._toOld(output));
},
set outputs(_value) { throw new Error('Use WorkspaceEdit to update cell outputs.'); },
get outputs2() { return that._outputs.map(output => NotebookCellOutput._fromOld(output, output.outputId)); },
get outputs2() { return that._outputs.map(output => NotebookCellOutput._fromDto(output, output.outputId)); },
set outputs2(_value) { throw new Error('Use WorkspaceEdit to update cell outputs.'); },
get metadata() { return that._metadata; },
set metadata(_value) { throw new Error('Use WorkspaceEdit to update cell metadata.'); },
......@@ -135,7 +131,7 @@ export class ExtHostCell extends Disposable {
this._onDidDispose.fire();
}
setOutputs(newOutputs: IDisplayOutputDto[]): void {
setOutputs(newOutputs: IOutputDto[]): void {
this._outputs = newOutputs;
}
......@@ -390,7 +386,7 @@ export class ExtHostNotebookDocument extends Disposable {
});
}
private _setCellOutputs(index: number, outputs: IDisplayOutputDto[]): void {
private _setCellOutputs(index: number, outputs: IOutputDto[]): void {
const cell = this._cells[index];
cell.setOutputs(outputs);
this._emitter.emitCellOutputsChange({ document: this.notebookDocument, cells: [cell.cell] });
......
......@@ -31,7 +31,7 @@ import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { CellEditType, CellOutputKind, ICellDto2, INotebookDecorationRenderOptions, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellEditType, ICellDto2, INotebookDecorationRenderOptions, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ITestItem, ITestState } from 'vs/workbench/contrib/testing/common/testCollection';
export interface PositionLike {
......@@ -1322,7 +1322,7 @@ export namespace LanguageSelector {
export namespace NotebookCellData {
export function from(data: vscode.NotebookCellData): ICellDto2 {
let outputs: IDisplayOutputDto[];
let outputs: IOutputDto[];
const [first] = data.outputs;
if (!first) {
outputs = [];
......@@ -1342,7 +1342,7 @@ export namespace NotebookCellData {
}
export namespace NotebookCellOutput {
export function from(output: types.NotebookCellOutput): IDisplayOutputDto {
export function from(output: types.NotebookCellOutput): IOutputDto {
const data = Object.create(null);
const custom = Object.create(null);
......@@ -1354,7 +1354,6 @@ export namespace NotebookCellOutput {
return {
outputId: output.id,
outputKind: CellOutputKind.Rich,
data,
metadata: isEmptyObject(custom) ? undefined : { custom }
};
......
......@@ -13,7 +13,7 @@ import { URI } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files';
import { RemoteAuthorityResolverErrorCode } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { CellEditType, ICellEditOperation, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellEditType, ICellEditOperation, IOutputDto, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import type * as vscode from 'vscode';
function es5ClassCompat(target: Function): any {
......@@ -2843,6 +2843,36 @@ export class NotebookCellOutputItem {
export class NotebookCellOutput {
static _toOld(output: IOutputDto): vscode.CellOutput {
if (output.data['application/x.notebook.stream']) {
return {
outputKind: CellOutputKind.Text,
text: output.data['application/x.notebook.stream'] as string
};
} else if (output.data['application/x.notebook.error-traceback']) {
return {
outputKind: CellOutputKind.Error,
ename: (output.data['application/x.notebook.error-traceback'] as any)['ename'],
evalue: (output.data['application/x.notebook.error-traceback'] as any)['evalue'],
traceback: (output.data['application/x.notebook.error-traceback'] as any)['traceback'],
};
} else {
return {
outputKind: CellOutputKind.Rich,
data: output.data,
metadata: output.metadata
};
}
}
static _fromDto(output: IOutputDto, id?: string) {
const items: NotebookCellOutputItem[] = [];
for (const key in output.data) {
items.push(new NotebookCellOutputItem(key, output.data[key], output.metadata?.custom ? output.metadata?.custom[key] : undefined));
}
return new NotebookCellOutput(items, id);
}
static _fromOld(output: vscode.CellOutput, id?: string): NotebookCellOutput {
switch (output.outputKind) {
case CellOutputKind.Error:
......
......@@ -14,7 +14,7 @@ import { CodeEditorWidget, ICodeEditorWidgetOptions } from 'vs/editor/browser/wi
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { CellEditType, CellUri, IDisplayOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellEditType, CellUri, IOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMenu, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
......@@ -564,7 +564,7 @@ abstract class AbstractElementRenderer extends Disposable {
}
}
private _getFormatedOutputJSON(outputs: IDisplayOutputDto[]) {
private _getFormatedOutputJSON(outputs: IOutputDto[]) {
return JSON.stringify(outputs, undefined, '\t');
}
......
......@@ -22,7 +22,7 @@ import { OutputRenderer } from 'vs/workbench/contrib/notebook/browser/view/outpu
import { RunStateRenderer, TimerRenderer } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer';
import { CellViewModel, IModelDecorationsChangeAccessor, NotebookViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { CellKind, NotebookCellMetadata, NotebookDocumentMetadata, IEditor, INotebookKernelInfo2, ICellRange, IOrderedMimeType, IDisplayOutputDto, INotebookRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, NotebookCellMetadata, NotebookDocumentMetadata, IEditor, INotebookKernelInfo2, ICellRange, IOrderedMimeType, IOutputDto, INotebookRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { IMenu } from 'vs/platform/actions/common/actions';
......@@ -110,7 +110,7 @@ export interface ICellOutputViewModel {
/**
* When rendering an output, `model` should always be used as we convert legacy `text/error` output to `display_data` output under the hood.
*/
model: IDisplayOutputDto;
model: IOutputDto;
resolveMimeTypes(textModel: NotebookTextModel): [readonly IOrderedMimeType[], number];
pickedMimeType: number;
supportAppend(): boolean;
......
......@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CellOutputKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { BrandedService, IConstructorSignature1 } from 'vs/platform/instantiation/common/instantiation';
import { ICommonNotebookEditor, IOutputTransformContribution } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
......@@ -11,7 +10,6 @@ export type IOutputTransformCtor = IConstructorSignature1<ICommonNotebookEditor,
export interface IOutputTransformDescription {
id: string;
kind: CellOutputKind;
ctor: IOutputTransformCtor;
}
......@@ -20,8 +18,8 @@ export const NotebookRegistry = new class NotebookRegistryImpl {
readonly outputTransforms: IOutputTransformDescription[] = [];
registerOutputTransform<Services extends BrandedService[]>(id: string, kind: CellOutputKind, ctor: { new(editor: ICommonNotebookEditor, ...services: Services): IOutputTransformContribution }): void {
this.outputTransforms.push({ id: id, kind: kind, ctor: ctor as IOutputTransformCtor });
registerOutputTransform<Services extends BrandedService[]>(id: string, ctor: { new(editor: ICommonNotebookEditor, ...services: Services): IOutputTransformContribution }): void {
this.outputTransforms.push({ id: id, ctor: ctor as IOutputTransformCtor });
}
getOutputTransformContributions(): IOutputTransformDescription[] {
......
......@@ -32,7 +32,7 @@ import { NotebookKernelProviderAssociationRegistry, NotebookViewTypesExtensionRe
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellEditType, CellKind, CellOutputKind, DisplayOrderKey, ICellEditOperation, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IDisplayOutputDto, mimeTypeIsAlwaysSecure, mimeTypeSupportedByCore, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, RENDERER_NOT_AVAILABLE, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellEditType, CellKind, DisplayOrderKey, ICellEditOperation, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IOutputDto, mimeTypeIsAlwaysSecure, mimeTypeSupportedByCore, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, RENDERER_NOT_AVAILABLE, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer';
import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
......@@ -500,14 +500,11 @@ export class NotebookService extends Disposable implements INotebookService, ICu
language: cell.language,
cellKind: cell.cellKind,
outputs: cell.outputs.map(output => {
if (output.outputKind === CellOutputKind.Rich) {
return {
...output,
outputId: UUID.generateUuid()
};
}
return output;
return {
...output,
// paste should generate new outputId
outputId: UUID.generateUuid()
};
}),
metadata: {
editable: cell.metadata?.editable,
......@@ -539,14 +536,10 @@ export class NotebookService extends Disposable implements INotebookService, ICu
language: cell.language,
cellKind: cell.cellKind,
outputs: cell.outputs.map(output => {
if (output.outputKind === CellOutputKind.Rich) {
return {
...output,
outputId: UUID.generateUuid()
};
}
return output;
return {
...output,
outputId: UUID.generateUuid()
};
}),
metadata: {
editable: cell.metadata?.editable,
......@@ -800,17 +793,12 @@ export class NotebookService extends Disposable implements INotebookService, ICu
return Iterable.map(this._models.values(), data => data.model);
}
getMimeTypeInfo(textModel: NotebookTextModel, output: IDisplayOutputDto): readonly IOrderedMimeType[] {
getMimeTypeInfo(textModel: NotebookTextModel, output: IOutputDto): readonly IOrderedMimeType[] {
// TODO@rebornix no string[] casting
return this._getOrderedMimeTypes(textModel, output, textModel.metadata.displayOrder as string[] ?? []);
}
private _getOrderedMimeTypes(textModel: NotebookTextModel, output: IDisplayOutputDto, documentDisplayOrder: string[]): IOrderedMimeType[] {
if (output.outputKind !== CellOutputKind.Rich) {
// TODO@rebornix at the end we only have one output
return [];
}
private _getOrderedMimeTypes(textModel: NotebookTextModel, output: IOutputDto, documentDisplayOrder: string[]): IOrderedMimeType[] {
const mimeTypes = Object.keys(output.data);
const coreDisplayOrder = this._displayOrder;
const sorted = sortMimeTypes(mimeTypes, coreDisplayOrder?.userOrder || [], documentDisplayOrder, coreDisplayOrder?.defaultOrder || []);
......
......@@ -11,14 +11,14 @@ import { URI } from 'vs/base/common/uri';
export class OutputRenderer {
protected readonly _contributions: { [key: string]: IOutputTransformContribution; };
protected readonly _mimeTypeMapping: { [key: number]: IOutputTransformContribution; };
protected readonly _renderers: IOutputTransformContribution[];
constructor(
notebookEditor: ICommonNotebookEditor,
private readonly instantiationService: IInstantiationService
) {
this._contributions = {};
this._mimeTypeMapping = {};
this._renderers = [];
const contributions = NotebookRegistry.getOutputTransformContributions();
......@@ -26,7 +26,7 @@ export class OutputRenderer {
try {
const contribution = this.instantiationService.createInstance(desc.ctor, notebookEditor);
this._contributions[desc.id] = contribution;
this._mimeTypeMapping[desc.kind] = contribution;
this._renderers.push(contribution);
} catch (err) {
onUnexpectedError(err);
}
......@@ -34,17 +34,15 @@ export class OutputRenderer {
}
renderNoop(viewModel: ICellOutputViewModel, container: HTMLElement): IRenderOutput {
const output = viewModel.model;
const contentNode = document.createElement('p');
contentNode.innerText = `No renderer could be found for output. It has the following output type: ${output.outputKind}`;
contentNode.innerText = `No renderer could be found for output.`;
container.appendChild(contentNode);
return { type: RenderOutputType.None, hasDynamicHeight: false };
}
render(viewModel: ICellOutputViewModel, container: HTMLElement, preferredMimeType: string | undefined, notebookUri: URI | undefined): IRenderOutput {
const output = viewModel.model;
const transform = this._mimeTypeMapping[output.outputKind];
const transform = this._renderers[0];
if (transform) {
return transform.render(viewModel, container, preferredMimeType, notebookUri);
......
......@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CellOutputKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { NotebookRegistry } from 'vs/workbench/contrib/notebook/browser/notebookRegistry';
import * as DOM from 'vs/base/browser/dom';
import { ICellOutputViewModel, ICommonNotebookEditor, IOutputTransformContribution, IRenderOutput, RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
......@@ -238,7 +237,7 @@ class RichRenderer implements IOutputTransformContribution {
}
NotebookRegistry.registerOutputTransform('notebook.output.rich', CellOutputKind.Rich, RichRenderer);
NotebookRegistry.registerOutputTransform('notebook.output.rich', RichRenderer);
export function getOutputSimpleEditorOptions(): IEditorOptions {
......
......@@ -20,7 +20,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { ICellOutputViewModel, ICommonCellInfo, ICommonNotebookEditor, IDisplayOutputLayoutUpdateRequest, IGenericCellViewModel, IInsetRenderOutput, RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { preloadsScriptStr } from 'vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads';
import { transformWebviewThemeVars } from 'vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping';
import { CellOutputKind, INotebookRendererInfo, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookRendererInfo, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { IWebviewService, WebviewContentPurpose, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
import { asWebviewUri } from 'vs/workbench/contrib/webview/common/webviewUri';
......@@ -87,7 +87,7 @@ export interface ICreationRequestMessage {
type: 'html';
content:
| { type: RenderOutputType.Html; htmlContent: string }
| { type: RenderOutputType.Extension; output: IDisplayOutputDto; mimeType: string };
| { type: RenderOutputType.Extension; output: IOutputDto; mimeType: string };
cellId: string;
outputId: string;
top: number;
......@@ -683,7 +683,6 @@ var requirejs = (function() {
type: RenderOutputType.Extension,
mimeType: content.mimeType,
output: {
outputKind: CellOutputKind.Rich,
metadata: output.metadata,
data: output.data,
outputId: output.outputId
......
......@@ -5,7 +5,7 @@
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { CellKind, IDisplayOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, IOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { IResourceUndoRedoElement, UndoRedoElementType } from 'vs/platform/undoRedo/common/undoRedo';
import { URI } from 'vs/base/common/uri';
import { BaseCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel';
......@@ -16,7 +16,7 @@ import { ITextCellEditingDelegate } from 'vs/workbench/contrib/notebook/common/m
export interface IViewCellEditingDelegate extends ITextCellEditingDelegate {
createCellViewModel?(cell: NotebookCellTextModel): BaseCellViewModel;
createCell?(index: number, source: string, language: string, type: CellKind, metadata: NotebookCellMetadata | undefined, outputs: IDisplayOutputDto[]): BaseCellViewModel;
createCell?(index: number, source: string, language: string, type: CellKind, metadata: NotebookCellMetadata | undefined, outputs: IOutputDto[]): BaseCellViewModel;
}
export class JoinCellEdit implements IResourceUndoRedoElement {
......
......@@ -6,13 +6,13 @@
import { Disposable } from 'vs/base/common/lifecycle';
import { ICellOutputViewModel, IGenericCellViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { IOrderedMimeType, IDisplayOutputDto, RENDERER_NOT_AVAILABLE } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { IOrderedMimeType, IOutputDto, RENDERER_NOT_AVAILABLE } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
let handle = 0;
export class CellOutputViewModel extends Disposable implements ICellOutputViewModel {
outputHandle = handle++;
get model(): IDisplayOutputDto {
get model(): IOutputDto {
return this._outputRawData;
}
......@@ -27,7 +27,7 @@ export class CellOutputViewModel extends Disposable implements ICellOutputViewMo
constructor(
readonly cellViewModel: IGenericCellViewModel,
private readonly _outputRawData: IDisplayOutputDto,
private readonly _outputRawData: IOutputDto,
private readonly _notebookService: INotebookService
) {
super();
......
......@@ -23,7 +23,7 @@ import { NotebookEventDispatcher, NotebookMetadataChangedEvent } from 'vs/workbe
import { CellFoldingState, EditorFoldingStateDelegate } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
import { MarkdownCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { CellKind, NotebookCellMetadata, INotebookSearchOptions, ICellRange, NotebookCellsChangeType, ICell, NotebookCellTextModelSplice, CellEditType, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, NotebookCellMetadata, INotebookSearchOptions, ICellRange, NotebookCellsChangeType, ICell, NotebookCellTextModelSplice, CellEditType, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { FoldingRegions } from 'vs/editor/contrib/folding/foldingRanges';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
......@@ -649,7 +649,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
return result;
}
createCell(index: number, source: string, language: string, type: CellKind, metadata: NotebookCellMetadata | undefined, outputs: IDisplayOutputDto[], synchronous: boolean, pushUndoStop: boolean = true, previouslyFocused: ICellViewModel[] = []): CellViewModel {
createCell(index: number, source: string, language: string, type: CellKind, metadata: NotebookCellMetadata | undefined, outputs: IOutputDto[], synchronous: boolean, pushUndoStop: boolean = true, previouslyFocused: ICellViewModel[] = []): CellViewModel {
const beforeSelections = previouslyFocused.map(e => e.handle);
this._notebook.applyEdits(this._notebook.versionId, [
{
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from 'vs/base/common/event';
import { ICell, NotebookCellOutputsSplice, CellKind, NotebookCellMetadata, NotebookDocumentMetadata, TransientOptions, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ICell, NotebookCellOutputsSplice, CellKind, NotebookCellMetadata, NotebookDocumentMetadata, TransientOptions, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
import { URI } from 'vs/base/common/uri';
import * as model from 'vs/editor/common/model';
......@@ -27,9 +27,9 @@ export class NotebookCellTextModel extends Disposable implements ICell {
private _onDidChangeLanguage = new Emitter<string>();
onDidChangeLanguage: Event<string> = this._onDidChangeLanguage.event;
private _outputs: IDisplayOutputDto[];
private _outputs: IOutputDto[];
get outputs(): IDisplayOutputDto[] {
get outputs(): IOutputDto[] {
return this._outputs;
}
......@@ -86,7 +86,7 @@ export class NotebookCellTextModel extends Disposable implements ICell {
private _source: string,
private _language: string,
public cellKind: CellKind,
outputs: IDisplayOutputDto[],
outputs: IOutputDto[],
metadata: NotebookCellMetadata | undefined,
public readonly transientOptions: TransientOptions,
private readonly _modelService: ITextModelService
......
......@@ -7,7 +7,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { INotebookTextModel, NotebookCellOutputsSplice, NotebookDocumentMetadata, NotebookCellMetadata, ICellEditOperation, CellEditType, CellUri, notebookDocumentMetadataDefaults, diff, NotebookCellsChangeType, ICellDto2, TransientOptions, NotebookTextModelChangedEvent, NotebookRawContentEvent, CellOutputKind, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookTextModel, NotebookCellOutputsSplice, NotebookDocumentMetadata, NotebookCellMetadata, ICellEditOperation, CellEditType, CellUri, notebookDocumentMetadataDefaults, diff, NotebookCellsChangeType, ICellDto2, TransientOptions, NotebookTextModelChangedEvent, NotebookRawContentEvent, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ITextSnapshot } from 'vs/editor/common/model';
import { IUndoRedoService, UndoRedoElementType, IUndoRedoElement, IResourceUndoRedoElement, UndoRedoGroup, IWorkspaceUndoRedoElement } from 'vs/platform/undoRedo/common/undoRedo';
import { MoveCellEdit, SpliceCellsEdit, CellMetadataEdit } from 'vs/workbench/contrib/notebook/common/model/cellEdit';
......@@ -649,7 +649,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this._eventEmitter.emit({ kind: NotebookCellsChangeType.ChangeLanguage, index: this._cells.indexOf(cell), language: languageId, transient: false }, true);
}
private _spliceNotebookCellOutputs2(cellHandle: number, outputs: IDisplayOutputDto[], computeUndoRedo: boolean): void {
private _spliceNotebookCellOutputs2(cellHandle: number, outputs: IOutputDto[], computeUndoRedo: boolean): void {
const cell = this._mapping.get(cellHandle);
if (!cell) {
return;
......@@ -702,19 +702,12 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
}
class OutputSequence implements ISequence {
constructor(readonly outputs: IDisplayOutputDto[]) {
constructor(readonly outputs: IOutputDto[]) {
}
getElements(): Int32Array | number[] | string[] {
return this.outputs.map(output => {
switch (output.outputKind) {
case CellOutputKind.Rich:
return hash([output.outputKind, output.metadata, output.data]);
// case CellOutputKind.Error:
// return hash([output.outputKind, output.ename, output.evalue, output.traceback]);
// case CellOutputKind.Text:
// return hash([output.outputKind, output.text]);
}
return hash([output.metadata, output.data]);
});
}
......
......@@ -29,12 +29,6 @@ export enum CellKind {
Code = 2
}
export enum CellOutputKind {
Text = 1,
Error = 2,
Rich = 3
}
export const NOTEBOOK_DISPLAY_ORDER = [
'application/json',
'application/javascript',
......@@ -152,8 +146,7 @@ export interface IOrderedMimeType {
isTrusted: boolean;
}
export interface IDisplayOutputDto {
outputKind: CellOutputKind.Rich;
export interface IOutputDto {
/**
* { mime_type: value }
*/
......@@ -169,7 +162,7 @@ export interface ICell {
handle: number;
language: string;
cellKind: CellKind;
outputs: IDisplayOutputDto[];
outputs: IOutputDto[];
metadata?: NotebookCellMetadata;
onDidChangeOutputs?: Event<NotebookCellOutputsSplice[]>;
onDidChangeLanguage: Event<string>;
......@@ -203,7 +196,7 @@ export type NotebookCellTextModelSplice<T> = [
export type NotebookCellOutputsSplice = [
start: number /* start */,
deleteCount: number /* delete count */,
newOutputs: IDisplayOutputDto[]
newOutputs: IOutputDto[]
];
export interface IMainCellDto {
......@@ -213,7 +206,7 @@ export interface IMainCellDto {
eol: string;
language: string;
cellKind: CellKind;
outputs: IDisplayOutputDto[];
outputs: IOutputDto[];
metadata?: NotebookCellMetadata;
}
......@@ -262,7 +255,7 @@ export interface NotebookCellsModelMoveEvent<T> {
export interface NotebookOutputChangedEvent {
readonly kind: NotebookCellsChangeType.Output;
readonly index: number;
readonly outputs: IDisplayOutputDto[];
readonly outputs: IOutputDto[];
}
export interface NotebookCellsChangeLanguageEvent {
......@@ -317,7 +310,7 @@ export interface ICellDto2 {
source: string;
language: string;
cellKind: CellKind;
outputs: IDisplayOutputDto[];
outputs: IOutputDto[];
metadata?: NotebookCellMetadata;
}
......@@ -331,7 +324,7 @@ export interface ICellReplaceEdit {
export interface ICellOutputEdit {
editType: CellEditType.Output;
index: number;
outputs: IDisplayOutputDto[];
outputs: IOutputDto[];
append?: boolean
}
......
......@@ -10,7 +10,7 @@ import { NotebookExtensionDescription } from 'vs/workbench/api/common/extHost.pr
import { Event } from 'vs/base/common/event';
import {
INotebookTextModel, INotebookRendererInfo,
IEditor, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter, IOrderedMimeType, IDisplayOutputDto
IEditor, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter, IOrderedMimeType, IOutputDto
} from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { CancellationToken } from 'vs/base/common/cancellation';
......@@ -49,7 +49,7 @@ export interface INotebookService {
onDidChangeNotebookActiveKernel: Event<{ uri: URI, providerHandle: number | undefined, kernelFriendlyId: string | undefined; }>;
registerNotebookController(viewType: string, extensionData: NotebookExtensionDescription, controller: IMainNotebookController): IDisposable;
getMimeTypeInfo(textModel: NotebookTextModel, output: IDisplayOutputDto): readonly IOrderedMimeType[];
getMimeTypeInfo(textModel: NotebookTextModel, output: IOutputDto): readonly IOrderedMimeType[];
registerNotebookKernelProvider(provider: INotebookKernelProvider): IDisposable;
getContributedNotebookKernels(viewType: string, resource: URI, token: CancellationToken): Promise<INotebookKernelInfo2[]>;
......
......@@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri';
import { IRequestHandler } from 'vs/base/common/worker/simpleWorker';
import * as model from 'vs/editor/common/model';
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
import { CellKind, ICellDto2, IMainCellDto, INotebookDiffResult, IDisplayOutputDto, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookCellsSplice2, NotebookDataDto, NotebookDocumentMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, ICellDto2, IMainCellDto, INotebookDiffResult, IOutputDto, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookCellsSplice2, NotebookDataDto, NotebookDocumentMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { Range } from 'vs/editor/common/core/range';
import { EditorWorkerHost } from 'vs/workbench/contrib/notebook/common/services/notebookWorkerServiceImpl';
......@@ -45,7 +45,7 @@ class MirrorCell {
private _source: string | string[],
public language: string,
public cellKind: CellKind,
public outputs: IDisplayOutputDto[],
public outputs: IOutputDto[],
public metadata?: NotebookCellMetadata
) { }
......
......@@ -4,12 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { CellKind, CellEditType, CellOutputKind, NotebookTextModelChangedEvent } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, CellEditType, NotebookTextModelChangedEvent } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { withTestNotebook, TestCell, setupInstantiationService } from 'vs/workbench/contrib/notebook/test/testNotebookEditor';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { assertType } from 'vs/base/common/types';
suite('NotebookTextModel', () => {
const instantiationService = setupInstantiationService();
......@@ -197,7 +196,6 @@ suite('NotebookTextModel', () => {
index: 0,
editType: CellEditType.Output,
outputs: [{
outputKind: CellOutputKind.Rich,
outputId: 'someId',
data: { 'text/markdown': '_Hello_' }
}]
......@@ -205,7 +203,6 @@ suite('NotebookTextModel', () => {
assert.strictEqual(textModel.cells.length, 1);
assert.strictEqual(textModel.cells[0].outputs.length, 1);
assert.strictEqual(textModel.cells[0].outputs[0].outputKind, CellOutputKind.Rich);
// append
textModel.applyEdits(textModel.versionId, [{
......@@ -213,7 +210,6 @@ suite('NotebookTextModel', () => {
editType: CellEditType.Output,
append: true,
outputs: [{
outputKind: CellOutputKind.Rich,
outputId: 'someId2',
data: { 'text/markdown': '_Hello2_' }
}]
......@@ -222,8 +218,6 @@ suite('NotebookTextModel', () => {
assert.strictEqual(textModel.cells.length, 1);
assert.strictEqual(textModel.cells[0].outputs.length, 2);
let [first, second] = textModel.cells[0].outputs;
assertType(first.outputKind === CellOutputKind.Rich);
assertType(second.outputKind === CellOutputKind.Rich);
assert.strictEqual(first.outputId, 'someId');
assert.strictEqual(second.outputId, 'someId2');
......@@ -232,7 +226,6 @@ suite('NotebookTextModel', () => {
index: 0,
editType: CellEditType.Output,
outputs: [{
outputKind: CellOutputKind.Rich,
outputId: 'someId3',
data: { 'text/plain': 'Last, replaced output' }
}]
......@@ -241,7 +234,6 @@ suite('NotebookTextModel', () => {
assert.strictEqual(textModel.cells.length, 1);
assert.strictEqual(textModel.cells[0].outputs.length, 1);
[first] = textModel.cells[0].outputs;
assertType(first.outputKind === CellOutputKind.Rich);
assert.strictEqual(first.outputId, 'someId3');
}
);
......
......@@ -18,7 +18,7 @@ import { NotebookEventDispatcher } from 'vs/workbench/contrib/notebook/browser/v
import { CellViewModel, IModelDecorationsChangeAccessor, NotebookViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { CellKind, CellUri, INotebookEditorModel, NotebookCellMetadata, ICellRange, INotebookKernelInfo2, notebookDocumentMetadataDefaults, IDisplayOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellKind, CellUri, INotebookEditorModel, NotebookCellMetadata, ICellRange, INotebookKernelInfo2, notebookDocumentMetadataDefaults, IOutputDto } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
import { ICompositeCodeEditor, IEditor } from 'vs/editor/common/editorCommon';
import { NotImplementedError } from 'vs/base/common/errors';
......@@ -44,7 +44,7 @@ export class TestCell extends NotebookCellTextModel {
public source: string,
language: string,
cellKind: CellKind,
outputs: IDisplayOutputDto[],
outputs: IOutputDto[],
modelService: ITextModelService
) {
super(CellUri.generate(URI.parse('test:///fake/notebook'), handle), handle, source, language, cellKind, outputs, undefined, { transientMetadata: {}, transientOutputs: false }, modelService);
......@@ -421,7 +421,7 @@ export function setupInstantiationService() {
return instantiationService;
}
export function withTestNotebook(instantiationService: TestInstantiationService, blukEditService: IBulkEditService, undoRedoService: IUndoRedoService, cells: [string, string, CellKind, IDisplayOutputDto[], NotebookCellMetadata][], callback: (editor: TestNotebookEditor, viewModel: NotebookViewModel, textModel: NotebookTextModel) => void) {
export function withTestNotebook(instantiationService: TestInstantiationService, blukEditService: IBulkEditService, undoRedoService: IUndoRedoService, cells: [string, string, CellKind, IOutputDto[], NotebookCellMetadata][], callback: (editor: TestNotebookEditor, viewModel: NotebookViewModel, textModel: NotebookTextModel) => void) {
const textModelService = instantiationService.get(ITextModelService);
const modeService = instantiationService.get(IModeService);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册