Skip to content

Commit 119c008

Browse files
subhash-arabhiAchal1607
authored andcommitted
New and unexecuted cells will not display success or failure
1 parent 91e2f73 commit 119c008

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

vscode/src/notebooks/codeCellExecution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class CodeCellExecution {
3333
diagnostics: string[] | undefined,
3434
errorDiagnostics: string[] | undefined,
3535
metadata: any,
36-
executionOrder: number) => {
36+
executionOrder: number | undefined) => {
3737

3838
if (!this.isExecutionStarted) {
3939
this.handleExecutionStart(executionOrder);
@@ -98,7 +98,7 @@ export class CodeCellExecution {
9898
}
9999
}
100100

101-
private handleExecutionStart = async (executionOrder: number) => {
101+
private handleExecutionStart = async (executionOrder: number | undefined) => {
102102
if (this.controller) {
103103
this.execution = this.controller.createNotebookCellExecution(this.cell);
104104
this.isExecutionStarted = true;

vscode/src/notebooks/kernel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class IJNBKernel implements Disposable {
156156
}
157157

158158
private getExecutionCounter = (notebookId: string) => {
159-
return IJNBKernel.executionCounter.get(notebookId) ?? 1;
159+
return IJNBKernel.executionCounter.get(notebookId);
160160
}
161161

162162
private handleMarkdownCellExecution = async (notebookId: string, cell: NotebookCell, controller: NotebookController) => {

vscode/src/notebooks/utils.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ export function parseCell(cell: ICell): vscode.NotebookCellData {
8484
(cell.metadata as IMetadata).executionSummary,
8585
cell.execution_count ?? null
8686
);
87-
cellData.executionSummary = {
88-
executionOrder: execSummary.executionOrder ?? undefined,
89-
success: execSummary.success,
90-
};
87+
if (execSummary.executionOrder) {
88+
cellData.executionSummary = {
89+
executionOrder: execSummary.executionOrder ?? undefined,
90+
success: execSummary.success,
91+
};
92+
}
9193

9294
if (Array.isArray(cell.outputs)) {
9395
const outputs = cell.outputs.flatMap((out: IOutput) => {
@@ -148,10 +150,10 @@ export function serializeCell(cell: vscode.NotebookCellData): ICell {
148150
if (cell.kind === vscode.NotebookCellKind.Code) {
149151
const exec = cell.executionSummary ?? {};
150152
const executionCount = exec.executionOrder ?? null;
151-
const success = exec.success ?? false;
153+
const success = exec.success;
152154

153155
const execSummary = new ExecutionSummary(executionCount, success);
154-
const metadata = { ...baseMeta, executionSummary: execSummary.toJSON()};
156+
const metadata = executionCount ? { ...baseMeta, executionSummary: execSummary.toJSON() } : {};
155157

156158
const outputs: IOutput[] = (cell.outputs || []).map((output): IOutput => {
157159
const data: IMimeBundle = {};

0 commit comments

Comments
 (0)