Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6769b76
Stub out ComponentAdapter.
ericsnowcurrently Sep 3, 2020
192c4b0
Implement ComponentAdapter.isMacDefaultPythonPath().
ericsnowcurrently Sep 8, 2020
0009f46
Implement ComponentAdapter.isWindowsStoreInterpreter().
ericsnowcurrently Sep 8, 2020
8034272
Implement ComponentAdapter.isCondaEnvironment().
ericsnowcurrently Sep 8, 2020
26e3736
Implement ComponentAdapter.hasInterpreters().
ericsnowcurrently Sep 8, 2020
2889a20
Add a convertEnvInfo() helper.
ericsnowcurrently Sep 8, 2020
2394160
Implement ComponentAdapter.getInterpreterInformation().
ericsnowcurrently Sep 8, 2020
200595d
Implement ComponentAdapter.getInterpreterDetails().
ericsnowcurrently Sep 8, 2020
4837898
Implement ComponentAdapter.getCondaEnvironment().
ericsnowcurrently Sep 9, 2020
cfd1796
Implement ComponentAdapter.getInterpreters().
ericsnowcurrently Sep 9, 2020
424aa09
Drop a dead line of code.
ericsnowcurrently Sep 9, 2020
63b5e83
Move IComponentAdapter to interpreter/contracts.ts.
ericsnowcurrently Sep 10, 2020
e9589d2
Drop the ComponentAdapter constructor placeholder code.
ericsnowcurrently Sep 10, 2020
6972c7c
Start out with the adapter disabled.
ericsnowcurrently Sep 10, 2020
941f8c0
lint
ericsnowcurrently Sep 15, 2020
3f79e87
Avoid an import cycle.
ericsnowcurrently Sep 15, 2020
7769f09
Use object destructuring for convertEnvInfo().
ericsnowcurrently Sep 15, 2020
99add1f
Use the "resource" arg in getInterpreterDetails().
ericsnowcurrently Sep 16, 2020
ed94edf
Drop "options" from the adapter getInterpreters().
ericsnowcurrently Sep 16, 2020
5e380ff
Fix a typo.
ericsnowcurrently Sep 16, 2020
6667d60
Clarify about when `undefined` is returned from the adapter methods.
ericsnowcurrently Sep 16, 2020
4271fd4
Use a map for converting the env kinds.
ericsnowcurrently Sep 16, 2020
c04c6f5
Handle iterator.onUpdated in ComponentAdapter.getInterpreters().
ericsnowcurrently Sep 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Stub out ComponentAdapter.
  • Loading branch information
ericsnowcurrently committed Sep 16, 2020
commit 6769b767a49c5ef7dce9495eb6fa717cdb5ffba9
76 changes: 75 additions & 1 deletion src/client/pythonEnvironments/legacyIOC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { injectable } from 'inversify';
import { Uri } from 'vscode';
import {
CONDA_ENV_FILE_SERVICE,
CONDA_ENV_SERVICE,
Expand All @@ -22,11 +23,13 @@ import {
WORKSPACE_VIRTUAL_ENV_SERVICE,
} from '../interpreter/contracts';
import { IPipEnvServiceHelper, IPythonInPathCommandProvider } from '../interpreter/locators/types';
//import { GetInterpreterOptions } from '../interpreter/interpreterService';
import { IServiceContainer, IServiceManager } from '../ioc/types';
import { initializeExternalDependencies } from './common/externalDependencies';
import { PythonInterpreterLocatorService } from './discovery/locators';
import { InterpreterLocatorHelper } from './discovery/locators/helpers';
import { InterpreterLocatorProgressService } from './discovery/locators/progressService';
import { CondaEnvironmentInfo } from './discovery/locators/services/conda';
import { CondaEnvFileService } from './discovery/locators/services/condaEnvFileService';
import { CondaEnvService } from './discovery/locators/services/condaEnvService';
import { CondaService } from './discovery/locators/services/condaService';
Expand All @@ -48,13 +51,28 @@ import {
WorkspaceVirtualEnvService,
} from './discovery/locators/services/workspaceVirtualEnvService';
import { WorkspaceVirtualEnvWatcherService } from './discovery/locators/services/workspaceVirtualEnvWatcherService';
import { GetInterpreterLocatorOptions } from './discovery/locators/types';
import { PythonEnvironment } from './info';
import { EnvironmentInfoService, IEnvironmentInfoService } from './info/environmentInfoService';

import { PythonEnvironments } from '.';

export const IComponentAdapter = Symbol('IComponentAdapter');
export interface IComponentAdapter {
// We will fill in the API separately.
// IInterpreterService
hasInterpreters: Promise<boolean>;
//getInterpreters(_resource?: vscode.Uri, _options?: GetInterpreterOptions): Promise<PythonEnvironment[]>;
getInterpreterDetails(pythonPath: string, _resource?: vscode.Uri): Promise<undefined | PythonEnvironment>;
// IInterpreterLocatorService
getInterpreters(resource?: vscode.Uri, options?: GetInterpreterLocatorOptions): Promise<PythonEnvironment[]>;
// IInterpreterHelper
getInterpreterInformation(pythonPath: string): Promise<undefined | Partial<PythonEnvironment>>;
isMacDefaultPythonPath(pythonPath: string): Promise<boolean | undefined>;
// ICondaService
isCondaEnvironment(interpreterPath: string): Promise<boolean | undefined>;
getCondaEnvironment(interpreterPath: string): Promise<CondaEnvironmentInfo | undefined>;
// IWindowsStoreInterpreter
isWindowsStoreInterpreter(pythonPath: string): Promise<boolean | undefined>;
}

@injectable()
Expand All @@ -70,6 +88,62 @@ class ComponentAdapter implements IComponentAdapter {
});
}
}

// IInterpreterHelper

public async getInterpreterInformation(_pythonPath: string): Promise<undefined | Partial<PythonEnvironment>> {
return undefined;
// ...
}

public async isMacDefaultPythonPath(_pythonPath: string): Promise<boolean> {
return false;
// ...
}

// IInterpreterService

public get hasInterpreters(): Promise<boolean> {
return Promise.resolve(false);
// ...
}

//public async getInterpreters(_resource?: Uri, _options?: GetInterpreterOptions): Promise<PythonEnvironment[]>;

public async getInterpreterDetails(_pythonPath: string, _resource?: Uri): Promise<undefined | PythonEnvironment> {
return undefined;
// ...
}

// ICondaService

public async isCondaEnvironment(_interpreterPath: string): Promise<boolean> {
return false;
// ...
}

public async getCondaEnvironment(_interpreterPath: string): Promise<CondaEnvironmentInfo | undefined> {
return undefined;
// ...
}

// IWindowsStoreInterpreter

public isWindowsStoreInterpreter(_pythonPath: string): boolean {
return false;
// ...
}

// IInterpreterLocatorService

public async getInterpreters(_resource?: Uri, _options?: GetInterpreterLocatorOptions): Promise<PythonEnvironment[]> {
//{
// ignoreCache?: boolean
// onSuggestion?: boolean;
//}
return [];
// ...
}
}

export function registerForIOC(serviceManager: IServiceManager, serviceContainer: IServiceContainer, api: PythonEnvironments): void {
Expand Down