diff --git a/api/build.js b/api/build.js index bf1f796b3ac..decb5e1d3a7 100644 --- a/api/build.js +++ b/api/build.js @@ -71,7 +71,7 @@ if (process.env.npm_config_tag === 'proposed') { return imports + [`declare module '@vscode/jupyter-extension' {`, `${tab}${line}`].join(EOL); } if (foundFirstExport) { - `${tab}${line}`; + return `${tab}${line}`; } return line; }) diff --git a/src/api.d.ts b/src/api.d.ts index dedb7879c12..a1535db88b8 100644 --- a/src/api.d.ts +++ b/src/api.d.ts @@ -15,7 +15,11 @@ export interface JupyterAPI { * Extensions can use this API to provide a list of Jupyter Servers to VS Code users with custom authentication schemes. * E.g. one could provide a list of Jupyter Servers that require Kerberos authentication or other. */ - createJupyterServerCollection(id: string, label: string): JupyterServerCollection; + createJupyterServerCollection( + id: string, + label: string, + serverProvider: JupyterServerProvider + ): JupyterServerCollection; } /** @@ -38,24 +42,7 @@ export interface JupyterServerConnectionInformation { * If a {@link token token} is not provided, then headers will be used to connect to the server. */ readonly headers?: Record; - /** - * The local directory that maps to the remote directory of the Jupyter Server. - * E.g. assume you start Jupyter Notebook on a remote machine with --notebook-dir=/foo/bar, - * and you have a file named /foo/bar/sample.ipynb, /foo/bar/sample2.ipynb and the like. - * Next assume you have local directory named /users/xyz/remoteServer with the files with the same names, sample.ipynb and sample2.ipynb - * - * - * Using this setting one can map the local directory to the remote directory. - * With the previous example in mind, the value of this property would be Uri.file('/users/xyz/remoteServer'). - * - * This results in Jupyter Session names being generated in a way thats is consistent with Jupyter Notebook/Lab. - * I.e. the session names map to the relative path of the notebook file. - * Taking the previous example into account, if one were to start a Remote Kernel for the local file `/users/xyz/remoteServer/sample2.ipynb`, - * then the name of the remote Jupyter Session would be `sample2.ipynb`. - * - * This is useful in the context where the remote Jupyter Server is running on the same machine as VS Code, but the files are mapped on different directories. - */ - readonly mappedRemote?: Uri; + /** * Returns the sub-protocols to be used. See details of `protocols` here https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket * Useful if there is a custom authentication scheme that needs to be used for WebSocket connections. @@ -89,25 +76,6 @@ export interface JupyterServer { readonly connectionInformation?: JupyterServerConnectionInformation; } -/** - * Represents a Jupyter Server with certain information that cannot be `undefined`. - * For instance the {@link connectionInformation} cannot be `undefined` as this is required to connect to the server. - */ -export interface ResolvedJupyterServer { - /** - * Unique identifier for this server. - */ - readonly id: string; - /** - * A human-readable string representing the name of the Server. - */ - readonly label: string; - /** - * Information required to Connect to the Jupyter Server. - */ - readonly connectionInformation: JupyterServerConnectionInformation; -} - /** * Provider of Jupyter Servers. */ @@ -126,7 +94,7 @@ export interface JupyterServerProvider { * Returns the connection information for the Jupyter server. * It is OK to return the given `server`. When no result is returned, the given `server` will be used. */ - resolveJupyterServer(server: JupyterServer, token: CancellationToken): ProviderResult; + resolveJupyterServer(server: JupyterServer, token: CancellationToken): ProviderResult; } /** @@ -153,7 +121,7 @@ export interface JupyterServerCommandProvider { * Returns a list of commands to be displayed to the user. * @param value The value entered by the user in the quick pick. */ - provideCommands(value: string | undefined, token: CancellationToken): Promise; + provideCommands(value: string | undefined, token: CancellationToken): ProviderResult; /** * Invoked when a {@link JupyterServerCommand command} has been selected. * @param command The {@link JupyterServerCommand command} selected by the user. @@ -186,10 +154,6 @@ export interface JupyterServerCollection { * A link to a resource containing more information. This can be read and updated by the extension. */ documentation?: Uri; - /** - * Provider of {@link JupyterServer Jupyter Servers}. This can be read and updated by the extension. - */ - serverProvider?: JupyterServerProvider; /** * Provider of {@link JupyterServerCommand Commands}. This can be read and updated by the extension. */ diff --git a/src/api.deprecated.d.ts b/src/api.deprecated.d.ts deleted file mode 100644 index dee6318012f..00000000000 --- a/src/api.deprecated.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { Uri } from 'vscode'; - -declare module './api' { - export interface JupyterServerCommandProvider { - /** - * Returns a list of commands to be displayed to the user. - * @deprecated Use `provideCommands` instead. - */ - commands?: JupyterServerCommand[]; - } - - export interface JupyterServerCommand { - /** - * @deprecated Use `label` instead. - */ - title?: string; - } -} diff --git a/src/api.internal.d.ts b/src/api.internal.d.ts index 8cefa4529f0..af3b638bc32 100644 --- a/src/api.internal.d.ts +++ b/src/api.internal.d.ts @@ -17,6 +17,10 @@ declare module './api' { * Used internally by Jupyter Extension to detect changes to the JupyterServerProvider. */ onDidChangeProvider: Event; + /** + * Used internal by Jupyter extension to tarck the Server Provider. + */ + readonly serverProvider: JupyterServerProvider; } export interface IJupyterUriProvider { /** diff --git a/src/api.proposed.kernelStarupHook.d.ts b/src/api.proposed.kernelStarupHook.d.ts index cce67b496b4..4ac7980d20e 100644 --- a/src/api.proposed.kernelStarupHook.d.ts +++ b/src/api.proposed.kernelStarupHook.d.ts @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -// https://github.com/microsoft/vscode-jupyter/issues/13893 - import type { Session } from '@jupyterlab/services'; import type { CancellationToken, Uri } from 'vscode'; declare module './api' { export interface JupyterServerProvider { /** + * Note: For Synapse, https://github.com/microsoft/vscode-jupyter/issues/13893 + * * Invoked after a kernel has been started, allowing the contributing extension to perform startup * actions on the kernel. * This is only invoked for kernels diff --git a/src/api.proposed.mappedRemoteDirectory.d.ts b/src/api.proposed.mappedRemoteDirectory.d.ts new file mode 100644 index 00000000000..88b5d5aa33a --- /dev/null +++ b/src/api.proposed.mappedRemoteDirectory.d.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Uri } from 'vscode'; + +declare module './api' { + export interface JupyterServer { + /** + * Note: Required for AzML, perhaps CodeSpaces and Pengs personal extension. + * + * The local directory that maps to the remote directory of the Jupyter Server. + * E.g. assume you start Jupyter Notebook on a remote machine with --notebook-dir=/foo/bar, + * and you have a file named /foo/bar/sample.ipynb, /foo/bar/sample2.ipynb and the like. + * Next assume you have local directory named /users/xyz/remoteServer with the files with the same names, sample.ipynb and sample2.ipynb + * + * + * Using this setting one can map the local directory to the remote directory. + * With the previous example in mind, the value of this property would be Uri.file('/users/xyz/remoteServer'). + * + * This results in Jupyter Session names being generated in a way thats is consistent with Jupyter Notebook/Lab. + * I.e. the session names map to the relative path of the notebook file. + * Taking the previous example into account, if one were to start a Remote Kernel for the local file `/users/xyz/remoteServer/sample2.ipynb`, + * then the name of the remote Jupyter Session would be `sample2.ipynb`. + * + * This is useful in the context where the remote Jupyter Server is running on the same machine as VS Code, but the files are mapped on different directories. + */ + readonly mappedRemoteDirectory?: Uri; + } +} diff --git a/src/api.proposed.removeJupyterServer.d.ts b/src/api.proposed.removeJupyterServer.d.ts index 688137663a8..77017ba22df 100644 --- a/src/api.proposed.removeJupyterServer.d.ts +++ b/src/api.proposed.removeJupyterServer.d.ts @@ -3,11 +3,12 @@ import { Uri } from 'vscode'; -// Ability to remove a Jupyter server is internal to the Jupyter Extension & Jupyter Hub extension. - declare module './api' { export interface JupyterServerProvider { /** + * Note: For Internal Jupyter Server Provider and JupyterHub extension. + * Ability to remove a Jupyter server is internal to the Jupyter Extension & Jupyter Hub extension. + * * Display a `trash` icon next to each server in the quick pick. * Allowing the user to remove this server. * Currently used only by the Jupyter Extension. diff --git a/src/kernels/jupyter/connection/jupyterServerProviderRegistry.ts b/src/kernels/jupyter/connection/jupyterServerProviderRegistry.ts index e5979314b51..b856045242c 100644 --- a/src/kernels/jupyter/connection/jupyterServerProviderRegistry.ts +++ b/src/kernels/jupyter/connection/jupyterServerProviderRegistry.ts @@ -27,18 +27,10 @@ import { traceError } from '../../../platform/logging'; import { JVSC_EXTENSION_ID } from '../../../platform/common/constants'; export class JupyterServerCollectionImpl extends Disposables implements JupyterServerCollection { - private _serverProvider?: JupyterServerProvider; private _commandProvider?: JupyterServerCommandProvider; documentation?: Uri | undefined; private _onDidChangeProvider = new EventEmitter(); onDidChangeProvider = this._onDidChangeProvider.event; - set serverProvider(value: JupyterServerProvider | undefined) { - this._serverProvider = value; - this._onDidChangeProvider.fire(); - } - get serverProvider(): JupyterServerProvider | undefined { - return this._serverProvider; - } set commandProvider(value: JupyterServerCommandProvider | undefined) { this._commandProvider = value; this._onDidChangeProvider.fire(); @@ -50,7 +42,8 @@ export class JupyterServerCollectionImpl extends Disposables implements JupyterS constructor( public readonly extensionId: string, public readonly id: string, - public label: string + public label: string, + public readonly serverProvider: JupyterServerProvider ) { super(); } @@ -112,26 +105,15 @@ class JupyterUriProviderAdaptor extends Disposables implements IJupyterUriProvid } const token = new CancellationTokenSource(); try { - let items: JupyterServerCommand[] = []; - if (this.provider.commandProvider.provideCommands) { - items = await this.provider.commandProvider.provideCommands(value || '', token.token); - if ( - (!items || !items.length) && - Array.isArray(this.provider.commandProvider.commands) && - this.provider.commandProvider.commands.length - ) { - items = this.provider.commandProvider.commands; - } - } else { - items = this.provider.commandProvider.commands || []; - } + const items = + (await Promise.resolve(this.provider.commandProvider.provideCommands(value || '', token.token))) || []; if (!value) { this.commands.clear(); } - items.forEach((c) => this.commands.set(c.label || c.title || '', c)); + items.forEach((c) => this.commands.set(c.label, c)); return items.map((c) => { return { - label: stripCodicons(c.label || c.title), + label: stripCodicons(c.label), description: stripCodicons(c.description), command: c }; @@ -196,7 +178,7 @@ class JupyterUriProviderAdaptor extends Disposables implements IJupyterUriProvid displayName: server.label, token: info.token || '', authorizationHeader: info.headers, - mappedRemoteNotebookDir: info.mappedRemote?.toString(), + mappedRemoteNotebookDir: server.mappedRemoteDirectory?.toString(), webSocketProtocols: info.webSocketProtocols }; } @@ -215,7 +197,7 @@ class JupyterUriProviderAdaptor extends Disposables implements IJupyterUriProvid displayName: server.label, token: info.token || '', authorizationHeader: info.headers, - mappedRemoteNotebookDir: info.mappedRemote?.toString(), + mappedRemoteNotebookDir: (result || server).mappedRemoteDirectory?.toString(), webSocketProtocols: info.webSocketProtocols }; } @@ -302,7 +284,12 @@ export class JupyterServerProviderRegistry extends Disposables implements IJupyt super(); disposables.push(this); } - createJupyterServerCollection(extensionId: string, id: string, label: string): JupyterServerCollection { + createJupyterServerCollection( + extensionId: string, + id: string, + label: string, + serverProvider: JupyterServerProvider + ): JupyterServerCollection { const extId = `${extensionId}#${id}`; if (this._collections.has(extId)) { // When testing we might have a duplicate as we call the registration API in ctor of a test. @@ -310,7 +297,7 @@ export class JupyterServerProviderRegistry extends Disposables implements IJupyt throw new Error(`Jupyter Server Provider with id ${extId} already exists`); } } - const collection = new JupyterServerCollectionImpl(extensionId, id, label); + const collection = new JupyterServerCollectionImpl(extensionId, id, label, serverProvider); this._collections.set(extId, collection); let uriRegistration: IDisposable | undefined; let adapter: JupyterUriProviderAdaptor | undefined; diff --git a/src/kernels/jupyter/types.ts b/src/kernels/jupyter/types.ts index 3ba0109ad27..35d2ff0cb59 100644 --- a/src/kernels/jupyter/types.ts +++ b/src/kernels/jupyter/types.ts @@ -24,7 +24,7 @@ import { } from '../types'; import { ClassType } from '../../platform/ioc/types'; import { ContributedKernelFinderKind, IContributedKernelFinder } from '../internalTypes'; -import { IJupyterServerUri, IJupyterUriProvider, JupyterServerCollection } from '../../api'; +import { IJupyterServerUri, IJupyterUriProvider, JupyterServerCollection, JupyterServerProvider } from '../../api'; import { IQuickPickItemProvider } from '../../platform/common/providerBasedQuickPick'; export type JupyterServerInfo = { @@ -308,5 +308,10 @@ export const IJupyterServerProviderRegistry = Symbol('IJupyterServerProviderRegi export interface IJupyterServerProviderRegistry { onDidChangeCollections: Event<{ added: JupyterServerCollection[]; removed: JupyterServerCollection[] }>; readonly jupyterCollections: readonly JupyterServerCollection[]; - createJupyterServerCollection(extensionId: string, id: string, label: string): JupyterServerCollection; + createJupyterServerCollection( + extensionId: string, + id: string, + label: string, + serverProvider: JupyterServerProvider + ): JupyterServerCollection; } diff --git a/src/notebooks/controllers/kernelSource/remoteNotebookKernelSourceSelector.ts b/src/notebooks/controllers/kernelSource/remoteNotebookKernelSourceSelector.ts index ff1b687ee63..dcc66405401 100644 --- a/src/notebooks/controllers/kernelSource/remoteNotebookKernelSourceSelector.ts +++ b/src/notebooks/controllers/kernelSource/remoteNotebookKernelSourceSelector.ts @@ -33,7 +33,7 @@ import { } from '../../../platform/common/constants'; import { dispose } from '../../../platform/common/helpers'; import { IDisposable } from '../../../platform/common/types'; -import { Common, DataScience } from '../../../platform/common/utils/localize'; +import { DataScience } from '../../../platform/common/utils/localize'; import { IMultiStepInput, InputFlowAction, @@ -202,17 +202,9 @@ export class RemoteNotebookKernelSourceSelector implements IRemoteNotebookKernel return (a.time || 0) > (b.time || 0) ? -1 : 1; }); - let recentlyUsedSeparatorAdded = false; serversAndTimes .filter(({ time }) => (time || 0) > 0) .forEach(({ server, time }) => { - if (!recentlyUsedSeparatorAdded) { - recentlyUsedSeparatorAdded = true; - quickPickServerItems.push({ - label: 'Recently Used', - kind: QuickPickItemKind.Separator - }); - } quickPickServerItems.push({ type: KernelFinderEntityQuickPickType.KernelFinder, kernelFinderInfo: server, @@ -235,18 +227,9 @@ export class RemoteNotebookKernelSourceSelector implements IRemoteNotebookKernel }); }); - let addedSeparator = false; serversAndTimes .filter(({ time }) => !time) .forEach(({ server }) => { - if (!addedSeparator) { - addedSeparator = true; - quickPickServerItems.push({ - label: DataScience.jupyterServerNotUsedBeforeQuickPickSeparatorTitle, - kind: QuickPickItemKind.Separator - }); - } - quickPickServerItems.push({ type: KernelFinderEntityQuickPickType.KernelFinder, kernelFinderInfo: server, @@ -278,13 +261,6 @@ export class RemoteNotebookKernelSourceSelector implements IRemoteNotebookKernel if (handledServerIds.has(id)) { return; } - if (!addedSeparator) { - addedSeparator = true; - quickPickServerItems.push({ - label: DataScience.jupyterServerNotUsedBeforeQuickPickSeparatorTitle, - kind: QuickPickItemKind.Separator - }); - } quickPickServerItems.push({ type: KernelFinderEntityQuickPickType.JupyterServer, @@ -319,7 +295,7 @@ export class RemoteNotebookKernelSourceSelector implements IRemoteNotebookKernel ); if (quickPickServerItems.length > 0 && newProviderItems.length) { quickPickCommandItems.push({ - label: Common.labelForQuickPickSeparatorIndicatingThereIsAnotherGroupOfMoreItems, + label: '', kind: QuickPickItemKind.Separator }); } @@ -406,10 +382,10 @@ export class RemoteNotebookKernelSourceSelector implements IRemoteNotebookKernel if (!provider.getQuickPickEntryItems) { return; } - const quickPickCommandItems = []; + const quickPickCommandItems: QuickPickItem[] = []; if (quickPickServerItems.length > 0) { quickPickCommandItems.push({ - label: Common.labelForQuickPickSeparatorIndicatingThereIsAnotherGroupOfMoreItems, + label: '', kind: QuickPickItemKind.Separator }); } diff --git a/src/platform/common/utils/localize.ts b/src/platform/common/utils/localize.ts index 174b0193fe5..1ef82eb7968 100644 --- a/src/platform/common/utils/localize.ts +++ b/src/platform/common/utils/localize.ts @@ -28,7 +28,6 @@ export namespace Common { export const reload = l10n.t('Reload'); export const moreInfo = l10n.t('More Info'); export const learnMore = l10n.t('Learn more'); - export const labelForQuickPickSeparatorIndicatingThereIsAnotherGroupOfMoreItems = l10n.t('More'); export const and = l10n.t('and'); export const reportThisIssue = l10n.t('Report this issue'); export const clickHereForMoreInfoWithHtml = (link: string) => diff --git a/src/standalone/api/api.jupyterProvider.vscode.test.ts b/src/standalone/api/api.jupyterProvider.vscode.test.ts index a2de9e85491..3ef4d1798b6 100644 --- a/src/standalone/api/api.jupyterProvider.vscode.test.ts +++ b/src/standalone/api/api.jupyterProvider.vscode.test.ts @@ -23,7 +23,7 @@ import { commands, notebooks } from 'vscode'; -import { JupyterServer } from '../../api'; +import { JupyterServer, JupyterServerProvider } from '../../api'; import { openAndShowNotebook } from '../../platform/common/utils/notebooks'; import { JupyterServer as JupyterServerStarter } from '../../test/datascience/jupyterServer.node'; import { IS_REMOTE_NATIVE_TEST } from '../../test/constants'; @@ -78,16 +78,16 @@ suite('Jupyter Provider Tests', function () { traceInfo(`End Test Completed ${this.currentTest?.title}`); }); test('Verify Kernel Source Action is registered & unregistered for the 3rd party extension', async () => { - const collection1 = api.createJupyterServerCollection('sample1', 'First Collection'); - const collection2 = api.createJupyterServerCollection('sample2', 'Second Collection'); - collection1.serverProvider = { + const serverProvider1 = { provideJupyterServers: () => Promise.resolve([]), resolveJupyterServer: () => Promise.reject(new Error('Not Implemented')) }; - collection2.serverProvider = { + const serverProvider2 = { provideJupyterServers: () => Promise.resolve([]), resolveJupyterServer: () => Promise.reject(new Error('Not Implemented')) }; + const collection1 = api.createJupyterServerCollection('sample1', 'First Collection', serverProvider1); + const collection2 = api.createJupyterServerCollection('sample2', 'Second Collection', serverProvider2); disposables.push(collection1); disposables.push(collection2); let matchingDisposable1: IDisposable | undefined; @@ -239,15 +239,16 @@ suite('Jupyter Provider Tests', function () { // assert.strictEqual(remoteConnection.id, selectedItem!.id); // }); test('When there are 2 or more servers, then user is prompted to select a server', async () => { + const serverProvider: JupyterServerProvider = { + provideJupyterServers: () => Promise.resolve([]), + resolveJupyterServer: () => Promise.reject(new Error('Not Implemented')) + }; const collection = api.createJupyterServerCollection( 'sampleServerProvider2', - 'First Collection For Third Test' + 'First Collection For Third Test', + serverProvider ); disposables.push(collection); - collection.serverProvider = { - provideJupyterServers: () => Promise.resolve([]), - resolveJupyterServer: () => Promise.reject(new Error('Not Implemented')) - }; const server1: JupyterServer = { id: 'Server1ForTesting', label: 'Server 1', @@ -275,11 +276,9 @@ suite('Jupyter Provider Tests', function () { const servers = [server1, server2, server3]; const onDidChangeServers = new EventEmitter(); disposables.push(onDidChangeServers); - collection.serverProvider = { - onDidChangeServers: onDidChangeServers.event, - provideJupyterServers: () => Promise.resolve(servers), - resolveJupyterServer: () => Promise.reject(new Error('Not Implemented')) - }; + serverProvider.onDidChangeServers = onDidChangeServers.event; + serverProvider.provideJupyterServers = () => Promise.resolve(servers); + serverProvider.resolveJupyterServer = () => Promise.reject(new Error('Not Implemented')); let matchingProvider: NotebookKernelSourceActionProvider | undefined; await waitForCondition( diff --git a/src/standalone/api/api.ts b/src/standalone/api/api.ts index c23f9992a99..b3b4de771b0 100644 --- a/src/standalone/api/api.ts +++ b/src/standalone/api/api.ts @@ -19,7 +19,6 @@ import { IExportedKernelService, IJupyterUriProvider, JupyterServerCollection, - JupyterServerProvider, JupyterServerCommandProvider } from '../../api'; import { stripCodicons } from '../../platform/common/helpers'; @@ -163,76 +162,62 @@ export function buildApi( }); return notebookEditor.notebook; }, - createJupyterServerCollection: (id, label) => { + createJupyterServerCollection: (id, label, serverProvider) => { label = stripCodicons(label); let documentation: Uri | undefined; - let serverProvider: JupyterServerProvider | undefined; let commandProvider: JupyterServerCommandProvider | undefined; let isDisposed = false; let proxy: JupyterServerCollection | undefined; - const collection: JupyterServerCollection = { - dispose: () => { - isDisposed = true; - proxy?.dispose(); - }, - get onDidChangeProvider() { - // This event is not used by 3rd party extensions, hence returning a bogus event, - // 3rd party extensions will not see this, only required by TS compiler. - return () => ({ dispose: noop }); - }, - extensionId: '', - get id() { - return id; - }, - set label(value: string) { - label = stripCodicons(value); - label = value; - if (proxy) { - proxy.label = value; - } - }, - get label() { - return label; - }, - set documentation(value: Uri | undefined) { - documentation = value; - if (proxy) { - proxy.documentation = value; - } - }, - get documentation() { - return documentation; - }, - set commandProvider(value: JupyterServerCommandProvider | undefined) { - commandProvider = value; - if (proxy) { - proxy.commandProvider = value; + // Omit PEMS that are only used for internal usage. + // I.e. remove the unwanted PEMS and return the valid API to the extension. + const collection: Omit = + { + dispose: () => { + isDisposed = true; + proxy?.dispose(); + }, + get id() { + return id; + }, + set label(value: string) { + label = stripCodicons(value); + label = value; + if (proxy) { + proxy.label = value; + } + }, + get label() { + return label; + }, + set documentation(value: Uri | undefined) { + documentation = value; + if (proxy) { + proxy.documentation = value; + } + }, + get documentation() { + return documentation; + }, + set commandProvider(value: JupyterServerCommandProvider | undefined) { + commandProvider = value; + if (proxy) { + proxy.commandProvider = value; + } + }, + get commandProvider() { + return commandProvider; } - }, - get commandProvider() { - return commandProvider; - }, - set serverProvider(value: JupyterServerProvider | undefined) { - serverProvider = value; - if (proxy) { - proxy.serverProvider = value; - } - }, - get serverProvider() { - return serverProvider; - } - }; + }; let extensionId = ''; (async () => { sendApiUsageTelemetry(extensions, 'createJupyterServerCollection'); extensionId = (await extensions.determineExtensionFromCallStack()).extensionId; const registration = serviceContainer.get(IJupyterServerProviderRegistry); - proxy = registration.createJupyterServerCollection(extensionId, id, label); + proxy = registration.createJupyterServerCollection(extensionId, id, label, serverProvider); proxy.label = label; proxy.documentation = documentation; proxy.commandProvider = commandProvider; - proxy.serverProvider = serverProvider; if (isDisposed) { proxy.dispose(); } @@ -242,7 +227,8 @@ export function buildApi( ex ) ); - return collection; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return collection as any; } }; diff --git a/src/standalone/userJupyterServer/userServerUriProvider.unit.test.ts b/src/standalone/userJupyterServer/userServerUriProvider.unit.test.ts index 95f550447b4..4a1447b66d7 100644 --- a/src/standalone/userJupyterServer/userServerUriProvider.unit.test.ts +++ b/src/standalone/userJupyterServer/userServerUriProvider.unit.test.ts @@ -177,7 +177,7 @@ suite('User Uri Provider', () => { const collection = mock(); when(collection.dispose()).thenReturn(); when( - jupyterServerProviderRegistry.createJupyterServerCollection(anything(), anything(), anything()) + jupyterServerProviderRegistry.createJupyterServerCollection(anything(), anything(), anything(), anything()) ).thenReturn(instance(collection)); const appEnv = mock(); when(appEnv.channel).thenReturn('stable'); diff --git a/src/standalone/userJupyterServer/userServerUrlProvider.ts b/src/standalone/userJupyterServer/userServerUrlProvider.ts index 4f05326573b..8afa5d0b67d 100644 --- a/src/standalone/userJupyterServer/userServerUrlProvider.ts +++ b/src/standalone/userJupyterServer/userServerUrlProvider.ts @@ -157,11 +157,11 @@ export class UserJupyterServerUrlProvider const collection = this.jupyterServerProviderRegistry.createJupyterServerCollection( JVSC_EXTENSION_ID, this.id, - this.displayName + this.displayName, + this ); this.disposables.push(collection); collection.commandProvider = this; - collection.serverProvider = this; collection.documentation = this.documentation; this.onDidChangeHandles(() => this._onDidChangeServers.fire(), this, this.disposables); this.disposables.push(