Skip to content

Commit

Permalink
Hlleo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Aug 9, 2022
1 parent 645873a commit ee8873e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/client/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,19 @@ export interface IProposedExtensionAPI {
registerEnvironmentProvider(
environmentProvider: IEnvironmentProvider,
metadata: EnvironmentProviderMetadata,
): Promise<void>;
): Promise<void>; // TODO: Disposable??
};
}

interface IEnvironmentProvider {
locator: ILocatorClass;
// TODO: createEnv
createLocator: (root?: string) => ILocatorAPI;
getEnvironmentDetails: (env: EnvInfo) => Promise<EnvironmentDetails | undefined>;
}

export interface ILocatorClass {
new (root?: string): ILocatorAPI;
export interface ILocatorFactory {
// This should be a function instead.
createLocator: (root?: string) => ILocatorAPI;
}

export interface ILocatorAPI {
Expand Down
6 changes: 3 additions & 3 deletions src/client/pythonEnvironments/base/locators/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// eslint-disable-next-line max-classes-per-file
import { Uri } from 'vscode';
import { ILocatorClass } from '../../../apiTypes';
import { ILocatorFactory } from '../../../apiTypes';
import { IDisposable } from '../../../common/types';
import { iterEmpty } from '../../../common/utils/async';
import { getURIFilter } from '../../../common/utils/misc';
Expand Down Expand Up @@ -37,7 +37,7 @@ export class ExtensionLocators extends Locators<BasicEnvInfo> {
return combineIterators(iterators);
}

public addNewLocator(LocatorClass: ILocatorClass, isWorkspace: boolean): void {
public addNewLocator(LocatorClass: ILocatorFactory, isWorkspace: boolean): void {
if (isWorkspace) {
this.workspace.addNewLocator(LocatorClass);
}
Expand Down Expand Up @@ -145,7 +145,7 @@ export class WorkspaceLocators extends LazyResourceBasedLocator<BasicEnvInfo> {
);
}

public addNewLocator(LocatorClass: ILocatorClass): void {
public addNewLocator(LocatorClass: ILocatorFactory): void {
Object.keys(this.roots).forEach((key) => {
const root = this.roots[key];
const newLocator = new LocatorClass(root.fsPath);
Expand Down

0 comments on commit ee8873e

Please sign in to comment.