Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions src/managers/builtin/sysPythonManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export class SysPythonManager implements EnvironmentManager {

this._initialized = createDeferred();

await this.internalRefresh(false, SysManagerStrings.sysManagerDiscovering);

this._initialized.resolve();
try {
await this.internalRefresh(false, SysManagerStrings.sysManagerDiscovering);
} finally {
this._initialized.resolve();
}
}

refresh(_scope: RefreshEnvironmentsScope): Promise<void> {
Expand Down
33 changes: 18 additions & 15 deletions src/managers/conda/condaEnvManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,24 @@ export class CondaEnvManager implements EnvironmentManager, Disposable {

this._initialized = createDeferred();

await withProgress(
{
location: ProgressLocation.Window,
title: CondaStrings.condaDiscovering,
},
async () => {
this.collection = await refreshCondaEnvs(false, this.nativeFinder, this.api, this.log, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
this._initialized.resolve();
try {
await withProgress(
{
location: ProgressLocation.Window,
title: CondaStrings.condaDiscovering,
},
async () => {
this.collection = await refreshCondaEnvs(false, this.nativeFinder, this.api, this.log, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
} finally {
this._initialized.resolve();
}
}

async getEnvironments(scope: GetEnvironmentsScope): Promise<PythonEnvironment[]> {
Expand Down
38 changes: 22 additions & 16 deletions src/managers/pipenv/pipenvManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export class PipenvManager implements EnvironmentManager {

private _initialized: Deferred<void> | undefined;

constructor(public readonly nativeFinder: NativePythonFinder, public readonly api: PythonEnvironmentApi) {
constructor(
public readonly nativeFinder: NativePythonFinder,
public readonly api: PythonEnvironmentApi,
) {
this.name = 'pipenv';
this.displayName = 'Pipenv';
this.preferredPackageManagerId = 'ms-python.python:pip';
Expand All @@ -70,21 +73,24 @@ export class PipenvManager implements EnvironmentManager {

this._initialized = createDeferred();

await withProgress(
{
location: ProgressLocation.Window,
title: PipenvStrings.pipenvDiscovering,
},
async () => {
this.collection = await refreshPipenv(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
this._initialized.resolve();
try {
await withProgress(
{
location: ProgressLocation.Window,
title: PipenvStrings.pipenvDiscovering,
},
async () => {
this.collection = await refreshPipenv(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
} finally {
this._initialized.resolve();
}
}

private async loadEnvMap() {
Expand Down
38 changes: 22 additions & 16 deletions src/managers/poetry/poetryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export class PoetryManager implements EnvironmentManager, Disposable {
private readonly _onDidChangeEnvironments = new EventEmitter<DidChangeEnvironmentsEventArgs>();
public readonly onDidChangeEnvironments = this._onDidChangeEnvironments.event;

constructor(private readonly nativeFinder: NativePythonFinder, private readonly api: PythonEnvironmentApi) {
constructor(
private readonly nativeFinder: NativePythonFinder,
private readonly api: PythonEnvironmentApi,
) {
this.name = 'poetry';
this.displayName = 'Poetry';
this.preferredPackageManagerId = 'ms-python.python:poetry';
Expand All @@ -71,21 +74,24 @@ export class PoetryManager implements EnvironmentManager, Disposable {

this._initialized = createDeferred();

await withProgress(
{
location: ProgressLocation.Window,
title: PoetryStrings.poetryDiscovering,
},
async () => {
this.collection = await refreshPoetry(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
this._initialized.resolve();
try {
await withProgress(
{
location: ProgressLocation.Window,
title: PoetryStrings.poetryDiscovering,
},
async () => {
this.collection = await refreshPoetry(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
} finally {
this._initialized.resolve();
}
}

async getEnvironments(scope: GetEnvironmentsScope): Promise<PythonEnvironment[]> {
Expand Down
38 changes: 22 additions & 16 deletions src/managers/pyenv/pyenvManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export class PyEnvManager implements EnvironmentManager, Disposable {
private readonly _onDidChangeEnvironments = new EventEmitter<DidChangeEnvironmentsEventArgs>();
public readonly onDidChangeEnvironments = this._onDidChangeEnvironments.event;

constructor(private readonly nativeFinder: NativePythonFinder, private readonly api: PythonEnvironmentApi) {
constructor(
private readonly nativeFinder: NativePythonFinder,
private readonly api: PythonEnvironmentApi,
) {
this.name = 'pyenv';
this.displayName = 'PyEnv';
this.preferredPackageManagerId = 'ms-python.python:pip';
Expand All @@ -71,21 +74,24 @@ export class PyEnvManager implements EnvironmentManager, Disposable {

this._initialized = createDeferred();

await withProgress(
{
location: ProgressLocation.Window,
title: PyenvStrings.pyenvDiscovering,
},
async () => {
this.collection = await refreshPyenv(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
this._initialized.resolve();
try {
await withProgress(
{
location: ProgressLocation.Window,
title: PyenvStrings.pyenvDiscovering,
},
async () => {
this.collection = await refreshPyenv(false, this.nativeFinder, this.api, this);
await this.loadEnvMap();

this._onDidChangeEnvironments.fire(
this.collection.map((e) => ({ environment: e, kind: EnvironmentChangeKind.add })),
);
},
);
} finally {
this._initialized.resolve();
}
}

async getEnvironments(scope: GetEnvironmentsScope): Promise<PythonEnvironment[]> {
Expand Down
Loading