diff --git a/src/client/interpreter/contracts.ts b/src/client/interpreter/contracts.ts index 9be523db0a74f..69e68928e16dc 100644 --- a/src/client/interpreter/contracts.ts +++ b/src/client/interpreter/contracts.ts @@ -34,8 +34,8 @@ export interface IVirtualEnvironmentsSearchPathProvider { export const IComponentAdapter = Symbol('IComponentAdapter'); export interface IComponentAdapter { // IInterpreterLocatorService - hasInterpreters: Promise; - getInterpreters(resource?: Uri, options?: GetInterpreterLocatorOptions): Promise; + hasInterpreters: Promise | undefined; + getInterpreters(resource?: Uri, options?: GetInterpreterLocatorOptions): Promise; // IInterpreterService getInterpreterDetails(pythonPath: string, _resource?: Uri): Promise; // IInterpreterHelper diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 1b0cc965e5c59..b67502461feeb 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -116,12 +116,17 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment { class ComponentAdapter implements IComponentAdapter { constructor( // The adapter only wraps one thing: the component API. - private readonly api: PythonEnvironments + private readonly api: PythonEnvironments, + // For now we effecitvely disable the component. + private readonly enabled = false ) {} // IInterpreterHelper public async getInterpreterInformation(pythonPath: string): Promise> { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(pythonPath); if (env === undefined) { return undefined; @@ -130,6 +135,9 @@ class ComponentAdapter implements IComponentAdapter { } public async isMacDefaultPythonPath(pythonPath: string): Promise { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(pythonPath); if (env === undefined) { return undefined; @@ -139,7 +147,10 @@ class ComponentAdapter implements IComponentAdapter { // IInterpreterService - public get hasInterpreters(): Promise { + public get hasInterpreters(): Promise | undefined { + if (!this.enabled) { + return undefined; + } const iterator = this.api.iterEnvs(); return iterator.next().then((res) => { return !res.done; @@ -149,6 +160,9 @@ class ComponentAdapter implements IComponentAdapter { //public async getInterpreters(_resource?: vscode.Uri, _options?: GetInterpreterOptions): Promise; public async getInterpreterDetails(pythonPath: string, _resource?: vscode.Uri): Promise { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(pythonPath); if (env === undefined) { return undefined; @@ -159,6 +173,9 @@ class ComponentAdapter implements IComponentAdapter { // ICondaService public async isCondaEnvironment(interpreterPath: string): Promise { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(interpreterPath); if (env === undefined) { return undefined; @@ -167,6 +184,9 @@ class ComponentAdapter implements IComponentAdapter { } public async getCondaEnvironment(interpreterPath: string): Promise { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(interpreterPath); if (env === undefined) { return undefined; @@ -184,6 +204,9 @@ class ComponentAdapter implements IComponentAdapter { // IWindowsStoreInterpreter public async isWindowsStoreInterpreter(pythonPath: string): Promise { + if (!this.enabled) { + return undefined; + } const env = await this.api.resolveEnv(pythonPath); if (env === undefined) { return undefined; @@ -196,7 +219,10 @@ class ComponentAdapter implements IComponentAdapter { public async getInterpreters( resource?: vscode.Uri, _options?: GetInterpreterLocatorOptions - ): Promise { + ): Promise { + if (!this.enabled) { + return undefined; + } // We ignore the options: //{ // ignoreCache?: boolean