Skip to content

Commit 27270db

Browse files
authored
Ensure python selector supports returning created env (#25088)
1 parent 98aaab1 commit 27270db

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { BaseInterpreterSelectorCommand } from './base';
4949
import { untildify } from '../../../../common/helpers';
5050
import { useEnvExtension } from '../../../../envExt/api.internal';
5151
import { setInterpreterLegacy } from '../../../../envExt/api.legacy';
52+
import { CreateEnvironmentResult } from '../../../../pythonEnvironments/creation/proposed.createEnvApis';
5253

5354
export type InterpreterStateArgs = { path?: string; workspace: Resource };
5455
export type QuickPickType = IInterpreterQuickPickItem | ISpecialQuickPickItem | QuickPickItem;
@@ -229,12 +230,13 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand implem
229230
sendTelemetryEvent(EventName.SELECT_INTERPRETER_ENTER_OR_FIND);
230231
return this._enterOrBrowseInterpreterPath.bind(this);
231232
} else if (selection.label === this.createEnvironmentSuggestion.label) {
232-
this.commandManager
233-
.executeCommand(Commands.Create_Environment, {
233+
const createdEnv = (await Promise.resolve(
234+
this.commandManager.executeCommand(Commands.Create_Environment, {
234235
showBackButton: false,
235236
selectEnvironment: true,
236-
})
237-
.then(noop, noop);
237+
}),
238+
).catch(noop)) as CreateEnvironmentResult | undefined;
239+
state.path = createdEnv?.path;
238240
} else if (selection.label === this.noPythonInstalled.label) {
239241
this.commandManager.executeCommand(Commands.InstallPython).then(noop, noop);
240242
this.wasNoPythonInstalledItemClicked = true;

0 commit comments

Comments
 (0)