diff --git a/src/client/envExt/api.legacy.ts b/src/client/envExt/api.legacy.ts index 7546a429c76a..fb01e73bdfcf 100644 --- a/src/client/envExt/api.legacy.ts +++ b/src/client/envExt/api.legacy.ts @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { Terminal, Uri, WorkspaceFolder } from 'vscode'; +import { Terminal, Uri } from 'vscode'; import { getEnvExtApi, getEnvironment } from './api.internal'; import { EnvironmentType, PythonEnvironment as PythonEnvironmentLegacy } from '../pythonEnvironments/info'; import { PythonEnvironment, PythonTerminalOptions } from './types'; import { Architecture } from '../common/utils/platform'; import { parseVersion } from '../pythonEnvironments/base/info/pythonVersion'; import { PythonEnvType } from '../pythonEnvironments/base/info'; -import { traceError, traceInfo } from '../logging'; +import { traceError } from '../logging'; import { reportActiveInterpreterChanged } from '../environmentApi'; import { getWorkspaceFolder, getWorkspaceFolders } from '../common/vscodeApis/workspaceApis'; @@ -120,36 +120,6 @@ export async function getActiveInterpreterLegacy(resource?: Uri): Promise void, -): Promise { - const api = await getEnvExtApi(); - const pythonEnv = await api.resolveEnvironment(Uri.file(pythonPath)); - if (!pythonEnv) { - traceError(`EnvExt: Failed to resolve environment for ${pythonPath}`); - return; - } - - const envType = toEnvironmentType(pythonEnv); - if (envType === EnvironmentType.Conda) { - const packages = await api.getPackages(pythonEnv); - if (packages && packages.length > 0 && packages.some((pkg) => pkg.name.toLowerCase() === 'python')) { - return; - } - traceInfo(`EnvExt: Python not found in ${envType} environment ${pythonPath}`); - traceInfo(`EnvExt: Installing Python in ${envType} environment ${pythonPath}`); - await api.installPackages(pythonEnv, ['python']); - previousEnvMap.set(workspaceFolder?.uri.fsPath || '', pythonEnv); - reportActiveInterpreterChanged({ - path: pythonPath, - resource: workspaceFolder, - }); - callback(); - } -} - export async function setInterpreterLegacy(pythonPath: string, uri: Uri | undefined): Promise { const api = await getEnvExtApi(); const pythonEnv = await api.resolveEnvironment(Uri.file(pythonPath)); diff --git a/src/client/interpreter/interpreterService.ts b/src/client/interpreter/interpreterService.ts index 3a1aaed312ff..ad06fd7d051d 100644 --- a/src/client/interpreter/interpreterService.ts +++ b/src/client/interpreter/interpreterService.ts @@ -45,7 +45,7 @@ import { } from '../pythonEnvironments/base/locator'; import { sleep } from '../common/utils/async'; import { useEnvExtension } from '../envExt/api.internal'; -import { ensureEnvironmentContainsPythonLegacy, getActiveInterpreterLegacy } from '../envExt/api.legacy'; +import { getActiveInterpreterLegacy } from '../envExt/api.legacy'; type StoredPythonEnvironment = PythonEnvironment & { store?: boolean }; @@ -290,9 +290,6 @@ export class InterpreterService implements Disposable, IInterpreterService { @cache(-1, true) private async ensureEnvironmentContainsPython(pythonPath: string, workspaceFolder: WorkspaceFolder | undefined) { if (useEnvExtension()) { - await ensureEnvironmentContainsPythonLegacy(pythonPath, workspaceFolder, () => { - this.didChangeInterpreterEmitter.fire(workspaceFolder?.uri); - }); return; }