diff --git a/src/client/jupyter/jupyterIntegration.ts b/src/client/jupyter/jupyterIntegration.ts index a385248bff06..ec030f1133f6 100644 --- a/src/client/jupyter/jupyterIntegration.ts +++ b/src/client/jupyter/jupyterIntegration.ts @@ -14,10 +14,15 @@ import { GLOBAL_MEMENTO, IExtensions, IMemento, Resource } from '../common/types import { getDebugpyPackagePath } from '../debugger/extension/adapter/remoteLaunchers'; import { IEnvironmentActivationService } from '../interpreter/activation/types'; import { IInterpreterQuickPickItem, IInterpreterSelector } from '../interpreter/configuration/types'; -import { ICondaService, IInterpreterDisplay, IInterpreterStatusbarVisibilityFilter } from '../interpreter/contracts'; -import { PythonEnvironment } from '../pythonEnvironments/info'; +import { + ICondaService, + IInterpreterDisplay, + IInterpreterService, + IInterpreterStatusbarVisibilityFilter, +} from '../interpreter/contracts'; import { PylanceApi } from '../activation/node/pylanceApi'; import { ExtensionContextKey } from '../common/application/contextKeys'; +import type { Environment } from '../api/types'; type PythonApiForJupyterExtension = { /** @@ -25,7 +30,7 @@ type PythonApiForJupyterExtension = { */ getActivatedEnvironmentVariables( resource: Resource, - interpreter?: PythonEnvironment, + interpreter: Environment, allowExceptions?: boolean, ): Promise; getKnownSuggestions(resource: Resource): IInterpreterQuickPickItem[]; @@ -82,6 +87,7 @@ export class JupyterExtensionIntegration { @inject(IWorkspaceService) private workspaceService: IWorkspaceService, @inject(ICondaService) private readonly condaService: ICondaService, @inject(IContextKeyManager) private readonly contextManager: IContextKeyManager, + @inject(IInterpreterService) private interpreterService: IInterpreterService, ) {} public registerApi(jupyterExtensionApi: JupyterExtensionApi): JupyterExtensionApi | undefined { @@ -94,9 +100,12 @@ export class JupyterExtensionIntegration { jupyterExtensionApi.registerPythonApi({ getActivatedEnvironmentVariables: async ( resource: Resource, - interpreter?: PythonEnvironment, + env: Environment, allowExceptions?: boolean, - ) => this.envActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions), + ) => { + const interpreter = await this.interpreterService.getInterpreterDetails(env.path); + return this.envActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions); + }, getSuggestions: async (resource: Resource): Promise => this.interpreterSelector.getAllSuggestions(resource), getKnownSuggestions: (resource: Resource): IInterpreterQuickPickItem[] =>