diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts index 37e16207ddb..d1fafae7591 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts @@ -278,38 +278,6 @@ const apiTestSerializer: vscode.NotebookSerializer = { }); }); - test('onDidChangeCellExecutionState is fired', async () => { - const notebook = await openRandomNotebookDocument(); - const editor = await vscode.window.showNotebookDocument(notebook); - const cell = editor.notebook.cellAt(0); - - let eventCount = 0; - const def = new DeferredPromise(); - testDisposables.push(vscode.notebooks.onDidChangeNotebookCellExecutionState(e => { - try { - assert.strictEqual(e.cell.document.uri.toString(), cell.document.uri.toString(), 'event should be fired for the executing cell'); - - if (eventCount === 0) { - assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Pending, 'should be set to Pending'); - } else if (eventCount === 1) { - assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Executing, 'should be set to Executing'); - assert.strictEqual(cell.outputs.length, 0, 'no outputs yet: ' + JSON.stringify(cell.outputs[0])); - } else if (e.state === vscode.NotebookCellExecutionState.Idle) { - assert.strictEqual(cell.outputs.length, 1, 'should have an output'); - def.complete(); - } - - eventCount++; - } catch (err) { - def.error(err); - } - })); - - vscode.commands.executeCommand('notebook.cell.execute', { document: notebook.uri, ranges: [{ start: 0, end: 1 }] }); - - await def.p; - }); - test('Output changes are applied once the promise resolves', async function () { let called = false; diff --git a/src/vs/platform/extensions/common/extensionsApiProposals.ts b/src/vs/platform/extensions/common/extensionsApiProposals.ts index 77d4f0f0b20..1d494043e19 100644 --- a/src/vs/platform/extensions/common/extensionsApiProposals.ts +++ b/src/vs/platform/extensions/common/extensionsApiProposals.ts @@ -254,9 +254,6 @@ const _allApiProposals = { notebookCellExecution: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts', }, - notebookCellExecutionState: { - proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts', - }, notebookControllerAffinityHidden: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts', }, diff --git a/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts b/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts index 8c38e14647e..2a7e0a513e3 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts @@ -15,7 +15,7 @@ import { NotebookDto } from './mainThreadNotebookDto.js'; import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js'; import { INotebookEditor } from '../../contrib/notebook/browser/notebookBrowser.js'; import { INotebookEditorService } from '../../contrib/notebook/browser/services/notebookEditorService.js'; -import { INotebookCellExecution, INotebookExecution, INotebookExecutionStateService, NotebookExecutionType } from '../../contrib/notebook/common/notebookExecutionStateService.js'; +import { INotebookCellExecution, INotebookExecution, INotebookExecutionStateService } from '../../contrib/notebook/common/notebookExecutionStateService.js'; import { IKernelSourceActionProvider, INotebookKernel, INotebookKernelChangeEvent, INotebookKernelDetectionTask, INotebookKernelService, VariablesResult } from '../../contrib/notebook/common/notebookKernelService.js'; import { SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js'; import { ExtHostContext, ExtHostNotebookKernelsShape, ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainContext, MainThreadNotebookKernelsShape } from '../common/extHost.protocol.js'; @@ -146,12 +146,6 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape this._notebookExecutions.forEach(e => e.complete()); })); - this._disposables.add(this._notebookExecutionStateService.onDidChangeExecution(e => { - if (e.type === NotebookExecutionType.cell) { - this._proxy.$cellExecutionChanged(e.notebook, e.cellHandle, e.changed?.state); - } - })); - this._disposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(e => { for (const [handle, [kernel,]] of this._kernels) { if (e.oldKernel === kernel.id) { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index f5d481a15a0..92066e32b4d 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1391,10 +1391,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I checkProposedApiEnabled(extension, 'notebookKernelSource'); return extHostNotebookKernels.registerKernelSourceActionProvider(extension, notebookType, provider); }, - onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) { - checkProposedApiEnabled(extension, 'notebookCellExecutionState'); - return _asExtensionEvent(extHostNotebookKernels.onDidChangeNotebookCellExecutionState)(listener, thisArgs, disposables); - } }; // namespace: l10n diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index c9a739dffec..080d90b0832 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -2899,7 +2899,6 @@ export interface ExtHostNotebookKernelsShape { $executeCells(handle: number, uri: UriComponents, handles: number[]): Promise; $cancelCells(handle: number, uri: UriComponents, handles: number[]): Promise; $acceptKernelMessageFromRenderer(handle: number, editorId: string, message: any): void; - $cellExecutionChanged(uri: UriComponents, cellHandle: number, state: notebookCommon.NotebookCellExecutionState | undefined): void; $provideKernelSourceActions(handle: number, token: CancellationToken): Promise; $provideVariables(handle: number, requestId: string, notebookUri: UriComponents, parentId: number | undefined, kind: 'named' | 'indexed', start: number, token: CancellationToken): Promise; } diff --git a/src/vs/workbench/api/common/extHostNotebookKernels.ts b/src/vs/workbench/api/common/extHostNotebookKernels.ts index 1994bc803b5..d96cbc78588 100644 --- a/src/vs/workbench/api/common/extHostNotebookKernels.ts +++ b/src/vs/workbench/api/common/extHostNotebookKernels.ts @@ -18,9 +18,9 @@ import { IExtHostInitDataService } from './extHostInitDataService.js'; import { ExtHostNotebookController } from './extHostNotebook.js'; import { ExtHostCell, ExtHostNotebookDocument } from './extHostNotebookDocument.js'; import * as extHostTypeConverters from './extHostTypeConverters.js'; -import { NotebookCellExecutionState as ExtHostNotebookCellExecutionState, NotebookCellOutput, NotebookControllerAffinity2, NotebookVariablesRequestKind } from './extHostTypes.js'; +import { NotebookCellOutput, NotebookControllerAffinity2, NotebookVariablesRequestKind } from './extHostTypes.js'; import { asWebviewUri } from '../../contrib/webview/common/webview.js'; -import { INotebookKernelSourceAction, NotebookCellExecutionState } from '../../contrib/notebook/common/notebookCommon.js'; +import { INotebookKernelSourceAction } from '../../contrib/notebook/common/notebookCommon.js'; import { CellExecutionUpdateType } from '../../contrib/notebook/common/notebookExecutionService.js'; import { checkProposedApiEnabled } from '../../services/extensions/common/extensions.js'; import { SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js'; @@ -55,9 +55,6 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape { private readonly _kernelData = new Map(); private _handlePool: number = 0; - private readonly _onDidChangeCellExecutionState = new Emitter(); - readonly onDidChangeNotebookCellExecutionState = this._onDidChangeCellExecutionState.event; - constructor( mainContext: IMainContext, private readonly _initData: IExtHostInitDataService, @@ -511,19 +508,6 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape { obj.onDidReceiveMessage.fire(Object.freeze({ editor: editor.apiEditor, message })); } - $cellExecutionChanged(uri: UriComponents, cellHandle: number, state: NotebookCellExecutionState | undefined): void { - const document = this._extHostNotebook.getNotebookDocument(URI.revive(uri)); - const cell = document.getCell(cellHandle); - if (cell) { - const newState = state ? extHostTypeConverters.NotebookCellExecutionState.to(state) : ExtHostNotebookCellExecutionState.Idle; - if (newState !== undefined) { - this._onDidChangeCellExecutionState.fire({ - cell: cell.apiCell, - state: newState - }); - } - } - } // --- diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index e442d0fc230..28faf2a388a 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1657,21 +1657,6 @@ export namespace NotebookCellExecutionSummary { } } -export namespace NotebookCellExecutionState { - export function to(state: notebooks.NotebookCellExecutionState): vscode.NotebookCellExecutionState | undefined { - if (state === notebooks.NotebookCellExecutionState.Unconfirmed) { - return types.NotebookCellExecutionState.Pending; - } else if (state === notebooks.NotebookCellExecutionState.Pending) { - // Since the (proposed) extension API doesn't have the distinction between Unconfirmed and Pending, we don't want to fire an update for Pending twice - return undefined; - } else if (state === notebooks.NotebookCellExecutionState.Executing) { - return types.NotebookCellExecutionState.Executing; - } else { - throw new Error(`Unknown state: ${state}`); - } - } -} - export namespace NotebookCellKind { export function from(data: vscode.NotebookCellKind): notebooks.CellKind { switch (data) { diff --git a/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts b/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts deleted file mode 100644 index 67e5c4b0fbf..00000000000 --- a/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/124970 - - /** - * The execution state of a notebook cell. - */ - export enum NotebookCellExecutionState { - /** - * The cell is idle. - */ - Idle = 1, - /** - * Execution for the cell is pending. - */ - Pending = 2, - /** - * The cell is currently executing. - */ - Executing = 3, - } - - /** - * An event describing a cell execution state change. - */ - export interface NotebookCellExecutionStateChangeEvent { - /** - * The {@link NotebookCell cell} for which the execution state has changed. - */ - readonly cell: NotebookCell; - - /** - * The new execution state of the cell. - */ - readonly state: NotebookCellExecutionState; - } - - export namespace notebooks { - - /** - * An {@link Event} which fires when the execution state of a cell has changed. - */ - // todo@API this is an event that is fired for a property that cells don't have and that makes me wonder - // how a correct consumer works, e.g the consumer could have been late and missed an event? - export const onDidChangeNotebookCellExecutionState: Event; - } -}