Initial work adding NotebookCellData.mime

For #126280
For #126417
This commit is contained in:
Matt Bierner
2021-06-15 15:16:24 -07:00
parent 92160bf660
commit cd08aa0081
11 changed files with 100 additions and 13 deletions

View File

@@ -54,6 +54,7 @@ export class ExtHostCell {
readonly cellKind: notebookCommon.CellKind;
private _apiCell: vscode.NotebookCell | undefined;
private _mime: string | undefined;
constructor(
readonly notebook: ExtHostNotebookDocument,
@@ -85,6 +86,8 @@ export class ExtHostCell {
notebook: that.notebook.apiNotebook,
kind: extHostTypeConverters.NotebookCellKind.to(this._cellData.cellKind),
document: data.document,
get mime() { return that._mime; },
set mime(value: string | undefined) { that._mime = value; },
get outputs() { return that._outputs.slice(0); },
get metadata() { return that._metadata; },
get executionSummary() { return that._previousResult; }
@@ -116,6 +119,10 @@ export class ExtHostCell {
this._internalMetadata = newInternalMetadata;
this._previousResult = extHostTypeConverters.NotebookCellExecutionSummary.to(newInternalMetadata);
}
setMime(newMime: string | undefined) {
}
}
export interface INotebookEventEmitter {
@@ -223,6 +230,8 @@ export class ExtHostNotebookDocument {
this._setCellOutputItems(rawEvent.index, rawEvent.outputId, rawEvent.append, rawEvent.outputItems);
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeLanguage) {
this._changeCellLanguage(rawEvent.index, rawEvent.language);
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMime) {
this._changeCellMime(rawEvent.index, rawEvent.mime);
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMetadata) {
this._changeCellMetadata(rawEvent.index, rawEvent.metadata);
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellInternalMetadata) {
@@ -345,6 +354,11 @@ export class ExtHostNotebookDocument {
}
}
private _changeCellMime(index: number, newMime: string | undefined): void {
const cell = this._cells[index];
cell.apiCell.mime = newMime;
}
private _changeCellMetadata(index: number, newMetadata: notebookCommon.NotebookCellMetadata): void {
const cell = this._cells[index];