Johannes
2022-04-20 11:30:31 +02:00
parent 931f4df9dc
commit 8783c56eb7
3 changed files with 9 additions and 6 deletions

View File

@@ -1001,7 +1001,9 @@ suite('Notebook & LiveShare', function () {
suiteDisposables.push(vscode.workspace.registerNotebookSerializer(notebookType, new class implements vscode.NotebookSerializer {
deserializeNotebook(content: Uint8Array, _token: vscode.CancellationToken): vscode.NotebookData | Thenable<vscode.NotebookData> {
const value = new TextDecoder().decode(content);
return new vscode.NotebookData([new vscode.NotebookCellData(vscode.NotebookCellKind.Code, value, 'fooLang')]);
const cell1 = new vscode.NotebookCellData(vscode.NotebookCellKind.Code, value, 'fooLang');
cell1.outputs = [new vscode.NotebookCellOutput([vscode.NotebookCellOutputItem.stderr(value)])];
return new vscode.NotebookData([cell1]);
}
serializeNotebook(data: vscode.NotebookData, _token: vscode.CancellationToken): Uint8Array | Thenable<Uint8Array> {
return new TextEncoder().encode(data.cells[0].value);
@@ -1030,6 +1032,7 @@ suite('Notebook & LiveShare', function () {
assert.ok(data instanceof vscode.NotebookData);
assert.strictEqual(data.cells.length, 1);
assert.strictEqual(data.cells[0].value, value);
assert.strictEqual(new TextDecoder().decode(data.cells[0].outputs![0].items[0].data), value);
});
test('command: vscode.executeNotebookToData', async function () {