From 1e7454f72ad8fe4a65dae95233a7b784e55383f5 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 25 Sep 2020 18:04:10 +0200 Subject: [PATCH] renames --- .../vscode-notebook-tests/src/notebook.test.ts | 6 +++--- src/vs/vscode.proposed.d.ts | 12 +++++------- src/vs/workbench/api/common/extHost.api.impl.ts | 2 +- .../workbench/api/common/extHostNotebookEditor.ts | 4 ++-- .../workbench/api/common/extHostTypeConverters.ts | 4 ++-- src/vs/workbench/api/common/extHostTypes.ts | 14 +++++++------- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/extensions/vscode-notebook-tests/src/notebook.test.ts b/extensions/vscode-notebook-tests/src/notebook.test.ts index cf50115cfec..91a6a1c88e7 100644 --- a/extensions/vscode-notebook-tests/src/notebook.test.ts +++ b/extensions/vscode-notebook-tests/src/notebook.test.ts @@ -423,9 +423,9 @@ suite('Notebook API tests', () => { await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest'); await vscode.notebook.activeNotebookEditor!.edit(editBuilder => { - editBuilder.replaceCellOutput(0, [new vscode.NotebookCellOutputList([ - new vscode.NotebookCellOutput('application/foo', 'bar'), - new vscode.NotebookCellOutput('application/json', { data: true }, { metadata: true }), + editBuilder.replaceCellOutput(0, [new vscode.NotebookCellOutput([ + new vscode.NotebookCellOutputItem('application/foo', 'bar'), + new vscode.NotebookCellOutputItem('application/json', { data: true }, { metadata: true }), ])]); }); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index bfd4abc7e06..ba70a20f195 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1226,8 +1226,7 @@ declare module 'vscode' { export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput; - //TODO@jrieken rename to NotebookCellOutputItem - export class NotebookCellOutput { + export class NotebookCellOutputItem { readonly mime: string; readonly value: unknown; @@ -1236,14 +1235,13 @@ declare module 'vscode' { constructor(mime: string, value: unknown, metadata?: Record); } - //TODO@jrieken rename to NotebookCellOutput //TODO@jrieken add id? - export class NotebookCellOutputList { + export class NotebookCellOutput { - readonly outputs: NotebookCellOutput[]; + readonly outputs: NotebookCellOutputItem[]; readonly metadata?: Record; - constructor(outputs: NotebookCellOutput[], metadata?: Record); + constructor(outputs: NotebookCellOutputItem[], metadata?: Record); } export enum NotebookCellRunState { @@ -1434,7 +1432,7 @@ declare module 'vscode' { export interface NotebookEditorEdit { replaceMetadata(value: NotebookDocumentMetadata): void; replaceCells(start: number, end: number, cells: NotebookCellData[]): void; - replaceCellOutput(index: number, outputs: (NotebookCellOutputList | CellOutput)[]): void; + replaceCellOutput(index: number, outputs: (NotebookCellOutput | CellOutput)[]): void; replaceCellMetadata(index: number, metadata: NotebookCellMetadata): void; } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 3fe0624bbfa..2a0576b68f9 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1148,8 +1148,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I NotebookRunState: extHostTypes.NotebookRunState, NotebookCellStatusBarAlignment: extHostTypes.NotebookCellStatusBarAlignment, NotebookEditorRevealType: extHostTypes.NotebookEditorRevealType, - NotebookCellOutputList: extHostTypes.NotebookCellOutputList, NotebookCellOutput: extHostTypes.NotebookCellOutput, + NotebookCellOutputItem: extHostTypes.NotebookCellOutputItem, }; }; } diff --git a/src/vs/workbench/api/common/extHostNotebookEditor.ts b/src/vs/workbench/api/common/extHostNotebookEditor.ts index e3a3859bb09..6db6bd3fdea 100644 --- a/src/vs/workbench/api/common/extHostNotebookEditor.ts +++ b/src/vs/workbench/api/common/extHostNotebookEditor.ts @@ -55,13 +55,13 @@ class NotebookEditorCellEditBuilder implements vscode.NotebookEditorEdit { }); } - replaceCellOutput(index: number, outputs: (vscode.NotebookCellOutputList | vscode.CellOutput)[]): void { + replaceCellOutput(index: number, outputs: (vscode.NotebookCellOutput | vscode.CellOutput)[]): void { this._throwIfFinalized(); this._collectedEdits.push({ editType: CellEditType.Output, index, outputs: outputs.map(output => { - if (extHostTypes.NotebookCellOutputList.isNotebookCellOutputList(output)) { + if (extHostTypes.NotebookCellOutput.isNotebookCellOutputList(output)) { return addIdToOutput(NotebookCellOutputList.from(output)); } else { return addIdToOutput(output); diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 78538a96118..45d6d5b7f97 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1296,7 +1296,7 @@ export namespace LogLevel { } export namespace NotebookCellOutputList { - export function from(output: types.NotebookCellOutputList): IDisplayOutput { + export function from(output: types.NotebookCellOutput): IDisplayOutput { let data: { [key: string]: unknown; } = {}; let custom: { [key: string]: unknown; } = {}; @@ -1318,7 +1318,7 @@ export namespace NotebookCellOutputList { } export namespace NotebookCellOutput { - export function from(output: types.NotebookCellOutput): IDisplayOutput { + export function from(output: types.NotebookCellOutputItem): IDisplayOutput { return { outputKind: CellOutputKind.Rich, data: { [output.mime]: output.value }, diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index c9c2e376d4a..281324d65f8 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -2772,10 +2772,10 @@ export enum ColorThemeKind { //#region Notebook -export class NotebookCellOutput { +export class NotebookCellOutputItem { - static isNotebookCellOutput(obj: unknown): obj is vscode.NotebookCellOutput { - return obj instanceof NotebookCellOutput; + static isNotebookCellOutput(obj: unknown): obj is vscode.NotebookCellOutputItem { + return obj instanceof NotebookCellOutputItem; } constructor( @@ -2785,14 +2785,14 @@ export class NotebookCellOutput { ) { } } -export class NotebookCellOutputList { +export class NotebookCellOutput { - static isNotebookCellOutputList(obj: unknown): obj is vscode.NotebookCellOutputList { - return obj instanceof NotebookCellOutputList; + static isNotebookCellOutputList(obj: unknown): obj is vscode.NotebookCellOutput { + return obj instanceof NotebookCellOutput; } constructor( - readonly outputs: NotebookCellOutput[], + readonly outputs: NotebookCellOutputItem[], readonly metadata?: Record ) { } }