Skip to content

Commit 69a54cf

Browse files
authored
Fix activated Conda Envs vars in Jupyter Ext API (#23212)
For microsoft/vscode-jupyter#15524
1 parent eed0c3b commit 69a54cf

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/client/jupyter/jupyterIntegration.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@ import { GLOBAL_MEMENTO, IExtensions, IMemento, Resource } from '../common/types
1414
import { getDebugpyPackagePath } from '../debugger/extension/adapter/remoteLaunchers';
1515
import { IEnvironmentActivationService } from '../interpreter/activation/types';
1616
import { IInterpreterQuickPickItem, IInterpreterSelector } from '../interpreter/configuration/types';
17-
import { ICondaService, IInterpreterDisplay, IInterpreterStatusbarVisibilityFilter } from '../interpreter/contracts';
18-
import { PythonEnvironment } from '../pythonEnvironments/info';
17+
import {
18+
ICondaService,
19+
IInterpreterDisplay,
20+
IInterpreterService,
21+
IInterpreterStatusbarVisibilityFilter,
22+
} from '../interpreter/contracts';
1923
import { PylanceApi } from '../activation/node/pylanceApi';
2024
import { ExtensionContextKey } from '../common/application/contextKeys';
25+
import type { Environment } from '../api/types';
2126

2227
type PythonApiForJupyterExtension = {
2328
/**
2429
* IEnvironmentActivationService
2530
*/
2631
getActivatedEnvironmentVariables(
2732
resource: Resource,
28-
interpreter?: PythonEnvironment,
33+
interpreter: Environment,
2934
allowExceptions?: boolean,
3035
): Promise<NodeJS.ProcessEnv | undefined>;
3136
getKnownSuggestions(resource: Resource): IInterpreterQuickPickItem[];
@@ -82,6 +87,7 @@ export class JupyterExtensionIntegration {
8287
@inject(IWorkspaceService) private workspaceService: IWorkspaceService,
8388
@inject(ICondaService) private readonly condaService: ICondaService,
8489
@inject(IContextKeyManager) private readonly contextManager: IContextKeyManager,
90+
@inject(IInterpreterService) private interpreterService: IInterpreterService,
8591
) {}
8692

8793
public registerApi(jupyterExtensionApi: JupyterExtensionApi): JupyterExtensionApi | undefined {
@@ -94,9 +100,12 @@ export class JupyterExtensionIntegration {
94100
jupyterExtensionApi.registerPythonApi({
95101
getActivatedEnvironmentVariables: async (
96102
resource: Resource,
97-
interpreter?: PythonEnvironment,
103+
env: Environment,
98104
allowExceptions?: boolean,
99-
) => this.envActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions),
105+
) => {
106+
const interpreter = await this.interpreterService.getInterpreterDetails(env.path);
107+
return this.envActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions);
108+
},
100109
getSuggestions: async (resource: Resource): Promise<IInterpreterQuickPickItem[]> =>
101110
this.interpreterSelector.getAllSuggestions(resource),
102111
getKnownSuggestions: (resource: Resource): IInterpreterQuickPickItem[] =>

0 commit comments

Comments
 (0)