Skip to content

Commit e27f875

Browse files
committed
Choose project for terminal
1 parent c29567b commit e27f875

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

package-lock.json

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/envCommands.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { removePythonProjectSetting, setEnvironmentManager, setPackageManager }
3030

3131
import { executeCommand } from '../common/command.api';
3232
import { clipboardWriteText } from '../common/env.apis';
33-
import {} from '../common/errors/utils';
33+
import { } from '../common/errors/utils';
3434
import { Pickers } from '../common/localize';
3535
import { pickEnvironment } from '../common/pickers/environments';
3636
import {
@@ -606,8 +606,9 @@ export async function createTerminalCommand(
606606
api: PythonEnvironmentApi,
607607
tm: TerminalManager,
608608
): Promise<Terminal | undefined> {
609-
if (context === undefined) {
610-
const pw = await pickProject(api.getPythonProjects());
609+
const pythonProjects = api.getPythonProjects();
610+
if (context === undefined || pythonProjects.length > 0) {
611+
const pw = await pickProject(pythonProjects);
611612
if (pw) {
612613
const env = await api.getEnvironment(pw.uri);
613614
const cwd = await findParentIfFile(pw.uri.fsPath);
@@ -641,7 +642,7 @@ export async function createTerminalCommand(
641642
}
642643
} else if (context instanceof PythonEnvTreeItem) {
643644
const view = context as PythonEnvTreeItem;
644-
const pw = await pickProject(api.getPythonProjects());
645+
const pw = await pickProject(pythonProjects);
645646
if (pw) {
646647
const cwd = await findParentIfFile(pw.uri.fsPath);
647648
const terminal = await tm.create(view.environment, { cwd });

0 commit comments

Comments
 (0)