Skip to content
Merged
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
9 changes: 5 additions & 4 deletions src/features/envCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { removePythonProjectSetting, setEnvironmentManager, setPackageManager }

import { executeCommand } from '../common/command.api';
import { clipboardWriteText } from '../common/env.apis';
import {} from '../common/errors/utils';
import { Pickers } from '../common/localize';
import { pickEnvironment } from '../common/pickers/environments';
import {
Expand Down Expand Up @@ -606,8 +605,10 @@ export async function createTerminalCommand(
api: PythonEnvironmentApi,
tm: TerminalManager,
): Promise<Terminal | undefined> {
if (context === undefined) {
const pw = await pickProject(api.getPythonProjects());
const pythonProjects = api.getPythonProjects();
// If no context is provided, or there are multiple projects, prompt the user to select a project for the terminal's cwd
if (context === undefined || pythonProjects.length > 0) {
const pw = await pickProject(pythonProjects);
if (pw) {
const env = await api.getEnvironment(pw.uri);
const cwd = await findParentIfFile(pw.uri.fsPath);
Expand Down Expand Up @@ -641,7 +642,7 @@ export async function createTerminalCommand(
}
} else if (context instanceof PythonEnvTreeItem) {
const view = context as PythonEnvTreeItem;
const pw = await pickProject(api.getPythonProjects());
const pw = await pickProject(pythonProjects);
if (pw) {
const cwd = await findParentIfFile(pw.uri.fsPath);
const terminal = await tm.create(view.environment, { cwd });
Expand Down
Loading