diff --git a/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts b/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts index 38c81e4ba0e..b6ce5aaa0f8 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts @@ -17,14 +17,12 @@ import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/no import { INotebookCellExecution, INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService'; import { INotebookKernel, INotebookKernelChangeEvent, INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier'; -import { ExtHostContext, ExtHostNotebookKernelsShape, ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainContext, MainThreadNotebookKernelsShape, NotebookControllerState } from '../common/extHost.protocol'; +import { ExtHostContext, ExtHostNotebookKernelsShape, ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainContext, MainThreadNotebookKernelsShape } from '../common/extHost.protocol'; abstract class MainThreadKernel implements INotebookKernel { private readonly _onDidChange = new Emitter(); private readonly preloads: { uri: URI; provides: string[] }[]; readonly onDidChange: Event = this._onDidChange.event; - private readonly _onDispose = new Emitter(); - readonly onDispose = this._onDispose.event; readonly id: string; readonly viewType: string; readonly extension: ExtensionIdentifier; @@ -34,7 +32,6 @@ abstract class MainThreadKernel implements INotebookKernel { description?: string; detail?: string; kind?: string; - state?: NotebookControllerState; supportedLanguages: string[]; implementsExecutionOrder: boolean; localResourceRoot: URI; @@ -57,7 +54,6 @@ abstract class MainThreadKernel implements INotebookKernel { this.description = data.description; this.detail = data.detail; this.kind = data.kind; - this.state = data.state; this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _languageService.getRegisteredLanguageIds(); this.implementsExecutionOrder = data.supportsExecutionOrder ?? false; this.localResourceRoot = URI.revive(data.extensionLocation); @@ -84,10 +80,6 @@ abstract class MainThreadKernel implements INotebookKernel { this.kind = data.kind; event.kind = true; } - if (data.state !== undefined) { - this.state = data.state; - event.state = true; - } if (data.supportedLanguages !== undefined) { this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._languageService.getRegisteredLanguageIds(); event.supportedLanguages = true; @@ -99,10 +91,6 @@ abstract class MainThreadKernel implements INotebookKernel { this._onDidChange.fire(event); } - dispose() { - this._onDispose.fire(); - } - abstract executeNotebookCellsRequest(uri: URI, cellHandles: number[]): Promise; abstract cancelNotebookCellExecution(uri: URI, cellHandles: number[]): Promise; } @@ -228,7 +216,7 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape }); const registration = this._notebookKernelService.registerKernel(kernel); - this._kernels.set(handle, [kernel, combinedDisposable(kernel, listener, registration)]); + this._kernels.set(handle, [kernel, combinedDisposable(listener, registration)]); } $updateKernel(handle: number, data: Partial): void { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 5140d9770d5..e4b23860c6e 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1315,7 +1315,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I NotebookCellOutputItem: extHostTypes.NotebookCellOutputItem, NotebookCellStatusBarItem: extHostTypes.NotebookCellStatusBarItem, NotebookControllerAffinity: extHostTypes.NotebookControllerAffinity, - NotebookControllerState: extHostTypes.NotebookControllerState, NotebookEdit: extHostTypes.NotebookEdit, PortAttributes: extHostTypes.PortAttributes, LinkedEditingRanges: extHostTypes.LinkedEditingRanges, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index d2e87c6e7c6..cff9c82244a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -970,11 +970,6 @@ export interface MainThreadNotebookDocumentsShape extends IDisposable { $trySaveNotebook(uri: UriComponents): Promise; } -export enum NotebookControllerState { - Idle = 1, - Connecting = 2 -} - export interface INotebookKernelDto2 { id: string; notebookType: string; @@ -984,7 +979,6 @@ export interface INotebookKernelDto2 { detail?: string; description?: string; kind?: string; - state?: NotebookControllerState; supportedLanguages?: string[]; supportsInterrupt?: boolean; supportsExecutionOrder?: boolean; diff --git a/src/vs/workbench/api/common/extHostNotebookKernels.ts b/src/vs/workbench/api/common/extHostNotebookKernels.ts index 4e4ca9640c5..f99ead59ac7 100644 --- a/src/vs/workbench/api/common/extHostNotebookKernels.ts +++ b/src/vs/workbench/api/common/extHostNotebookKernels.ts @@ -196,15 +196,6 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape { get rendererScripts() { return data.preloads ? data.preloads.map(extHostTypeConverters.NotebookRendererScript.to) : []; }, - get state() { - checkProposedApiEnabled(extension, 'notebookProxyController'); - return data.state; - }, - set state(value) { - checkProposedApiEnabled(extension, 'notebookProxyController'); - data.state = value; - _update(); - }, get executeHandler() { return _executeHandler; }, diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index fd1f2558140..039f43fce8b 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -3426,10 +3426,6 @@ export class NotebookRendererScript { } } -export enum NotebookControllerState { - Idle = 1, - Connecting = 2 -} //#endregion diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts b/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts index a62de5e8e65..bb1bd41aeb1 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts @@ -29,7 +29,7 @@ import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/note import { configureKernelIcon, selectKernelIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon'; -import { INotebookKernel, INotebookKernelService, NotebookControllerState } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; +import { INotebookKernel, INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite'; @@ -408,7 +408,7 @@ export class KernelStatus extends Disposable implements IWorkbenchContribution { this._kernelInfoElement.add(this._statusbarService.addEntry( { name: nls.localize('notebook.info', "Notebook Kernel Info"), - text: `$(notebook-kernel-select) ${kernel.label}` + (kernel.state === NotebookControllerState.Idle ? '' : ' Connecting...'), + text: `$(notebook-kernel-select) ${kernel.label}`, ariaLabel: kernel.label, tooltip: isSuggested ? nls.localize('tooltop', "{0} (suggestion)", tooltip) : tooltip, command: SELECT_KERNEL_ID, diff --git a/src/vs/workbench/contrib/notebook/browser/notebookExecutionServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookExecutionServiceImpl.ts index aa57b01e95a..75b6b1a55dd 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookExecutionServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookExecutionServiceImpl.ts @@ -64,18 +64,6 @@ export class NotebookExecutionService implements INotebookExecutionService, IDis executeCells.push(cell); } - if (kernel.state !== undefined) { - // kernel has connection state management - const kernelId = kernel.id; - kernel.onDispose(() => { - // proxy kernel scenario, kernel disposed, we should now make way for new preferred kernel - const exes = executeCells.map(c => this._notebookExecutionStateService.createCellExecution(kernelId, notebook.uri, c.handle)); - exes.forEach(e => e.complete({})); - - this.executeNotebookCells(notebook, executeCells); - }); - } - if (executeCells.length > 0) { this._notebookKernelService.selectKernelForNotebook(kernel, notebook); diff --git a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem.ts b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem.ts index 060e17ac37a..8b8f92277e2 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem.ts @@ -10,7 +10,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle'; import { localize } from 'vs/nls'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { executingStateIcon, selectKernelIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons'; -import { INotebookKernel, INotebookKernelMatchResult, INotebookKernelService, NotebookControllerState } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; +import { INotebookKernel, INotebookKernelMatchResult, INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { Event } from 'vs/base/common/event'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; @@ -121,11 +121,7 @@ export class NotebooKernelActionViewItem extends ActionViewItem { } private _generateKenrelLabel(kernel: INotebookKernel) { - if (kernel.state === NotebookControllerState.Connecting) { - return localize('kernelconnecting', "Connecting..."); - } else { - return kernel.label; - } + return kernel.label; } private _resetAction(): void { diff --git a/src/vs/workbench/contrib/notebook/common/notebookKernelService.ts b/src/vs/workbench/contrib/notebook/common/notebookKernelService.ts index e47d930372f..0068bd968e1 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookKernelService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookKernelService.ts @@ -28,16 +28,10 @@ export interface INotebookKernelChangeEvent { description?: true; detail?: true; kind?: true; - state?: true; supportedLanguages?: true; hasExecutionOrder?: true; } -export enum NotebookControllerState { - Idle = 1, - Connecting = 2 -} - export interface INotebookKernel { readonly id: string; readonly viewType: string; @@ -52,14 +46,12 @@ export interface INotebookKernel { description?: string; detail?: string; kind?: string; - state?: NotebookControllerState; supportedLanguages: string[]; implementsInterrupt?: boolean; implementsExecutionOrder?: boolean; executeNotebookCellsRequest(uri: URI, cellHandles: number[]): Promise; cancelNotebookCellExecution(uri: URI, cellHandles: number[]): Promise; - onDispose: Event; } export const enum ProxyKernelState { diff --git a/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts b/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts index 9ceec332a7a..b0a288f1e8e 100644 --- a/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts +++ b/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts @@ -20,7 +20,7 @@ import { NotebookViewModel } from 'vs/workbench/contrib/notebook/browser/viewMod import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { CellKind, IOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService'; -import { INotebookKernel, INotebookKernelService, ISelectedNotebooksChangeEvent, NotebookControllerState } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; +import { INotebookKernel, INotebookKernelService, ISelectedNotebooksChangeEvent } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { setupInstantiationService, withTestNotebook as _withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor'; @@ -178,7 +178,6 @@ class TestNotebookKernel implements INotebookKernel { preloadUris: URI[] = []; preloadProvides: string[] = []; supportedLanguages: string[] = []; - onDispose = Event.None; executeNotebookCellsRequest(): Promise { throw new Error('Method not implemented.'); } @@ -189,7 +188,6 @@ class TestNotebookKernel implements INotebookKernel { this.supportedLanguages = opts?.languages ?? [PLAINTEXT_LANGUAGE_ID]; } kind?: string | undefined; - state?: NotebookControllerState | undefined; implementsInterrupt?: boolean | undefined; implementsExecutionOrder?: boolean | undefined; } diff --git a/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts b/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts index 4763ee855c6..887a4a05443 100644 --- a/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts +++ b/src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts @@ -182,7 +182,6 @@ class TestNotebookKernel implements INotebookKernel { preloadUris: URI[] = []; preloadProvides: string[] = []; supportedLanguages: string[] = []; - onDispose = Event.None; async executeNotebookCellsRequest(): Promise { } async cancelNotebookCellExecution(): Promise { } diff --git a/src/vs/workbench/contrib/notebook/test/browser/notebookKernelService.test.ts b/src/vs/workbench/contrib/notebook/test/browser/notebookKernelService.test.ts index 54b3b52cb3c..b1ebabc1db2 100644 --- a/src/vs/workbench/contrib/notebook/test/browser/notebookKernelService.test.ts +++ b/src/vs/workbench/contrib/notebook/test/browser/notebookKernelService.test.ts @@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { setupInstantiationService, withTestNotebook as _withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor'; import { Emitter, Event } from 'vs/base/common/event'; -import { INotebookKernel, INotebookKernelService, NotebookControllerState } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; +import { INotebookKernel, INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { NotebookKernelService } from 'vs/workbench/contrib/notebook/browser/notebookKernelServiceImpl'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { mock } from 'vs/base/test/common/mock'; @@ -171,8 +171,6 @@ class TestNotebookKernel implements INotebookKernel { preloadUris: URI[] = []; preloadProvides: string[] = []; supportedLanguages: string[] = []; - state?: NotebookControllerState | undefined = undefined; - onDispose = Event.None; executeNotebookCellsRequest(): Promise { throw new Error('Method not implemented.'); } diff --git a/src/vs/workbench/services/actions/common/menusExtensionPoint.ts b/src/vs/workbench/services/actions/common/menusExtensionPoint.ts index 409cfb9924c..bceef1e438f 100644 --- a/src/vs/workbench/services/actions/common/menusExtensionPoint.ts +++ b/src/vs/workbench/services/actions/common/menusExtensionPoint.ts @@ -174,7 +174,8 @@ const apiMenus: IAPIMenu[] = [ { key: 'notebook/kernelSource', id: MenuId.NotebookKernelSource, - description: localize('notebook.kernelSource', "The contributed notebook kernel sources menu") + description: localize('notebook.kernelSource', "The contributed notebook kernel sources menu"), + proposed: 'notebookProxyController' }, { key: 'notebook/cell/title', diff --git a/src/vscode-dts/vscode.proposed.notebookProxyController.d.ts b/src/vscode-dts/vscode.proposed.notebookProxyController.d.ts index df429123049..a0f2c9e2df8 100644 --- a/src/vscode-dts/vscode.proposed.notebookProxyController.d.ts +++ b/src/vscode-dts/vscode.proposed.notebookProxyController.d.ts @@ -4,13 +4,4 @@ *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { - - export enum NotebookControllerState { - Idle = 1, - Connecting = 2 - } - - export interface NotebookController { - state?: NotebookControllerState; - } }