diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts index 01a7c87479e4335a896cacb8fd4d6a31262c8d03..b7bfc767d5d278c24a5c97c059595fbd9fe95bef 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts @@ -834,7 +834,6 @@ suite('Notebook API tests', function () { assert.ok(cell.executionSummary); assert.strictEqual(cell.executionSummary!.success, true); assert.strictEqual(typeof cell.executionSummary!.executionOrder, 'number'); - }); test('initialize executionSummary', async () => { diff --git a/src/vs/workbench/api/common/extHostNotebookKernels.ts b/src/vs/workbench/api/common/extHostNotebookKernels.ts index a83a15041305ebb5b05f5db266023f1193ac26a2..87e0868cc70ace507cdba8dc6ccf5a4a6ec13cb4 100644 --- a/src/vs/workbench/api/common/extHostNotebookKernels.ts +++ b/src/vs/workbench/api/common/extHostNotebookKernels.ts @@ -468,6 +468,10 @@ class NotebookCellExecutionTask extends Disposable { runEndTime: endTime, lastRunSuccess: success }); + + // The last update needs to be ordered correctly and applied immediately, + // so we use updateSoon and immediately flush. + that._collector.flush(); }, clearOutput(cell?: vscode.NotebookCell): Thenable { @@ -511,13 +515,17 @@ class TimeoutBasedCollector { this.batch.push(item); if (!this.waitPromise) { this.waitPromise = timeout(this.delay).then(() => { - this.waitPromise = undefined; - const batch = this.batch; - this.batch = []; - return this.callback(batch); + return this.flush(); }); } return this.waitPromise; } + + flush(): void | Promise { + this.waitPromise = undefined; + const batch = this.batch; + this.batch = []; + return this.callback(batch); + } }