Fix test, fix cell data startTime and duration visibility

This commit is contained in:
Rob Lourens 2021-04-14 17:59:49 -07:00
parent 3e5c20b762
commit edbdd6fe09
4 changed files with 6 additions and 4 deletions

View file

@ -218,7 +218,7 @@ suite('Notebook API tests', function () {
kind: vscode.NotebookCellKind.Code,
outputs: [],
metadata: new vscode.NotebookCellMetadata().with({ custom: { testCellMetadata: 123 } }),
latestExecutionSummary: { duration: 25 }
latestExecutionSummary: { startTime: 10, endTime: 20 }
},
{
source: 'test2',
@ -1379,7 +1379,8 @@ suite('Notebook API tests', function () {
const cell = editor.document.cellAt(0);
assert.strictEqual(cell.latestExecutionSummary?.success, undefined);
assert.strictEqual(cell.latestExecutionSummary?.duration, 25);
assert.strictEqual(cell.latestExecutionSummary?.startTime, 10);
assert.strictEqual(cell.latestExecutionSummary?.endTime, 20);
await saveAllFilesAndCloseAll(undefined);
});

View file

@ -1447,6 +1447,7 @@ export namespace NotebookCellPreviousExecutionResult {
export function from(data: vscode.NotebookCellExecutionSummary): Partial<notebooks.NotebookCellMetadata> {
return {
lastRunSuccess: data.success,
runStartTime: data.startTime,
runEndTime: data.endTime,
executionOrder: data.executionOrder
};

View file

@ -28,7 +28,7 @@ class CellStatusBarPlaceholderProvider implements INotebookCellStatusBarItemProv
async provideCellStatusBarItems(uri: URI, index: number, token: CancellationToken): Promise<INotebookCellStatusBarItemList> {
const doc = this._notebookService.getNotebookTextModel(uri);
const cell = doc?.cells[index];
if (typeof cell?.metadata.runState !== 'undefined') {
if (typeof cell?.metadata.runState !== 'undefined' || typeof cell?.metadata.lastRunSuccess !== 'undefined') {
return { items: [] };
}

View file

@ -848,7 +848,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
} else {
templateData.timer.clear();
}
} else if (metadata.runState === NotebookCellExecutionState.Idle && metadata.runStartTime && metadata.runEndTime) {
} else if (metadata.runState !== NotebookCellExecutionState.Pending && metadata.runStartTime && metadata.runEndTime) {
templateData.timer.show(metadata.runEndTime - metadata.runStartTime);
} else {
templateData.timer.clear();