Skip to content

Commit b5f7a8d

Browse files
authored
feat: add remove environment command to project view (#216)
![image](https://github.com/user-attachments/assets/3370a0ce-44ea-48a8-8381-be190d377b72)
1 parent b684972 commit b5f7a8d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@
366366
"group": "inline",
367367
"when": "view == python-projects && viewItem == python-env"
368368
},
369+
{
370+
"command": "python-envs.remove",
371+
"when": "view == python-projects && viewItem == python-env"
372+
},
369373
{
370374
"command": "python-envs.refreshPackages",
371375
"group": "inline",

src/features/envCommands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ export async function removeEnvironmentCommand(context: unknown, managers: Envir
171171
if (environment) {
172172
await manager?.remove(environment);
173173
}
174+
} else if (context instanceof ProjectEnvironment) {
175+
const view = context as ProjectEnvironment;
176+
const manager = managers.getEnvironmentManager(view.parent.project.uri);
177+
await manager?.remove(view.environment);
174178
} else {
175179
traceError(`Invalid context for remove command: ${context}`);
176180
}

0 commit comments

Comments
 (0)