Skip to content
Draft
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
20 changes: 18 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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,7 @@ import { removePythonProjectSetting, setEnvironmentManager, setPackageManager }

import { executeCommand } from '../common/command.api';
import { clipboardWriteText } from '../common/env.apis';
import {} from '../common/errors/utils';
import { } from '../common/errors/utils';
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an empty named import (import { } from ...) and the target module only exports helpers (no side effects). This should be removed (or replaced with a side-effect-only import if a side effect is actually required) to avoid dead/unused imports.

Suggested change
import { } from '../common/errors/utils';

Copilot uses AI. Check for mistakes.
import { Pickers } from '../common/localize';
import { pickEnvironment } from '../common/pickers/environments';
import {
Expand Down Expand Up @@ -606,8 +606,9 @@ 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 (context === undefined || pythonProjects.length > 0) {
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if (context === undefined || pythonProjects.length > 0) condition makes all subsequent else if branches effectively unreachable whenever there is at least one Python project. This causes the command to ignore the provided context (e.g., Uri/ProjectItem/PythonEnvTreeItem) and can create a terminal for a different environment/project than the one the user invoked the command on. Consider restoring the context-based branching (only enter the project-pick flow when context is undefined, or when you explicitly need to disambiguate between multiple projects) so that Uri/ProjectItem/PythonEnvTreeItem cases still behave correctly.

Suggested change
if (context === undefined || pythonProjects.length > 0) {
if (context === undefined) {

Copilot uses AI. Check for mistakes.
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