Skip to content

Commit

Permalink
adsasd
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Nov 21, 2023
1 parent 001dddb commit 52435bf
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ export abstract class LazyResourceBasedLocator extends Locator<BasicEnvInfo> imp
await this.disposables.dispose();
}

public async *iterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator<BasicEnvInfo> {
await this.activate();
public iterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator<BasicEnvInfo> {
const iterator = this.doIterEnvs(query);
const it = this._iterEnvs(iterator, query);
it.onUpdated = iterator.onUpdated;
yield* it;
return it;
}

private async *_iterEnvs(
iterator: IPythonEnvsIterator<BasicEnvInfo>,
query?: PythonLocatorQuery,
): IPythonEnvsIterator<BasicEnvInfo> {
await this.activate();
if (query?.envPath) {
let result = await iterator.next();
while (!result.done) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
switch (event.stage) {
case ProgressReportStage.discoveryFinished:
state.done = true;
listener.dispose();
break;
case ProgressReportStage.allPathsDiscovered:
if (!query) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function* iterEnvsIterator(
if (isProgressEvent(event)) {
if (event.stage === ProgressReportStage.discoveryFinished) {
state.done = true;
listener.dispose();
// listener.dispose();
} else {
didUpdate.fire(event);
}
Expand Down Expand Up @@ -128,7 +128,7 @@ function checkIfFinishedAndNotify(
) {
if (state.done && state.pending === 0) {
didUpdate.fire({ stage: ProgressReportStage.discoveryFinished });
didUpdate.dispose();
// didUpdate.dispose();
traceVerbose(`Finished with environment reducer`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class PythonEnvsResolver implements IResolvingLocator {
if (event.stage === ProgressReportStage.discoveryFinished) {
didUpdate.fire({ stage: ProgressReportStage.allPathsDiscovered });
state.done = true;
listener.dispose();
// listener.dispose();
} else {
didUpdate.fire(event);
}
Expand Down Expand Up @@ -176,7 +176,7 @@ function checkIfFinishedAndNotify(
) {
if (state.done && state.pending === 0) {
didUpdate.fire({ stage: ProgressReportStage.discoveryFinished });
didUpdate.dispose();
// didUpdate.dispose();
traceVerbose(`Finished with environment resolver`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class CondaEnvironmentLocator extends FSWatchingLocator {
}

// eslint-disable-next-line class-methods-use-this
public async *doIterEnvs(
public doIterEnvs(
_: unknown,
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment),
): IPythonEnvsIterator<BasicEnvInfo> {
Expand Down
1 change: 1 addition & 0 deletions src/client/pythonEnvironments/common/windowsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ async function getRegistryInterpretersImpl(useWorkerThreads: boolean): Promise<I
await getInterpreterDataFromRegistry(arch, hive, key, useWorkerThreads),
);
}
console.timeLog('Time taken for windows registry');
}
}
registryInterpretersCache = uniqBy(registryData, (r: IRegistryInterpreterData) => r.interpreterPath);
Expand Down
25 changes: 13 additions & 12 deletions src/client/pythonEnvironments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,22 @@ async function createLocator(

function createNonWorkspaceLocators(ext: ExtensionState): ILocator<BasicEnvInfo>[] {
const locators: (ILocator<BasicEnvInfo> & Partial<IDisposable>)[] = [];
locators.push(
locators
.push
// OS-independent locators go here.
new PyenvLocator(),
new CondaEnvironmentLocator(),
new ActiveStateLocator(),
new GlobalVirtualEnvironmentLocator(),
new CustomVirtualEnvironmentLocator(),
);
// new PyenvLocator(),
// new CondaEnvironmentLocator(),
// new ActiveStateLocator(),
// new GlobalVirtualEnvironmentLocator(),
// new CustomVirtualEnvironmentLocator(),
();

if (getOSType() === OSType.Windows) {
locators.push(
// Windows specific locators go here.
new WindowsRegistryLocator(),
new MicrosoftStoreLocator(),
new WindowsPathEnvVarLocator(),
// new MicrosoftStoreLocator(),
// new WindowsPathEnvVarLocator(),
);
} else {
locators.push(
Expand Down Expand Up @@ -184,9 +185,9 @@ function watchRoots(args: WatchRootsArgs): IDisposable {
function createWorkspaceLocator(ext: ExtensionState): WorkspaceLocators {
const locators = new WorkspaceLocators(watchRoots, [
(root: vscode.Uri) => [
new WorkspaceVirtualEnvironmentLocator(root.fsPath),
new PoetryLocator(root.fsPath),
new CustomWorkspaceLocator(root.fsPath),
// new WorkspaceVirtualEnvironmentLocator(root.fsPath),
// new PoetryLocator(root.fsPath),
// new CustomWorkspaceLocator(root.fsPath),
],
// Add an ILocator factory func here for each kind of workspace-rooted locator.
]);
Expand Down

0 comments on commit 52435bf

Please sign in to comment.