Group startTime and endTime into a single object

This commit is contained in:
Rob Lourens 2021-06-01 16:30:38 -07:00
parent ef28d1663d
commit 8df0f06858
3 changed files with 8 additions and 16 deletions

View file

@ -122,7 +122,7 @@ suite('Notebook API tests', function () {
kind: vscode.NotebookCellKind.Code,
outputs: [],
metadata: { custom: { testCellMetadata: 123 } },
executionSummary: { startTime: 10, endTime: 20 }
executionSummary: { timing: { startTime: 10, endTime: 20 } }
},
{
value: 'test2',
@ -1223,8 +1223,8 @@ suite('Notebook API tests', function () {
const cell = document.cellAt(0);
assert.strictEqual(cell.executionSummary?.success, undefined);
assert.strictEqual(cell.executionSummary?.startTime, 10);
assert.strictEqual(cell.executionSummary?.endTime, 20);
assert.strictEqual(cell.executionSummary?.timing?.startTime, 10);
assert.strictEqual(cell.executionSummary?.timing?.endTime, 20);
});

11
src/vs/vscode.d.ts vendored
View file

@ -11454,16 +11454,9 @@ declare module 'vscode' {
readonly success?: boolean;
/**
* The unix timestamp at which execution started.
* The times at which execution started and ended, as unix timestamps
*/
// @rob
//todo@API think about invalid state (no end, but start and vice versa)
readonly startTime?: number;
/**
* The unix timestamp at which execution ended.
*/
readonly endTime?: number;
readonly timing?: { startTime: number, endTime: number };
}
/**

View file

@ -1418,8 +1418,7 @@ export namespace NotebookRange {
export namespace NotebookCellExecutionSummary {
export function to(data: notebooks.NotebookCellInternalMetadata): vscode.NotebookCellExecutionSummary {
return {
startTime: data.runStartTime,
endTime: data.runEndTime,
timing: typeof data.runStartTime === 'number' && typeof data.runEndTime === 'number' ? { startTime: data.runStartTime, endTime: data.runEndTime } : undefined,
executionOrder: data.executionOrder,
success: data.lastRunSuccess
};
@ -1428,8 +1427,8 @@ export namespace NotebookCellExecutionSummary {
export function from(data: vscode.NotebookCellExecutionSummary): Partial<notebooks.NotebookCellInternalMetadata> {
return {
lastRunSuccess: data.success,
runStartTime: data.startTime,
runEndTime: data.endTime,
runStartTime: data.timing?.startTime,
runEndTime: data.timing?.endTime,
executionOrder: data.executionOrder
};
}