Skip to content

Commit 5b29669

Browse files
Refresh environment managers automatically when expanding tree node (#783)
When expanding environment manager nodes in the Environment Managers view, newly created environments (such as those created by `pipenv install pytest` or `conda create -n myenv`) were not appearing until the user manually refreshed the view. This change adds automatic refresh functionality for all environment managers when their tree node is expanded. The implementation: - Calls the existing `manager.refresh(undefined)` method before retrieving environments for any manager type - Affects all environment managers (Pipenv, Conda, Venv, Poetry, etc.) providing consistent behavior - Uses the established refresh mechanism that properly updates collections and fires change events **Before:** 1. Run `pipenv install pytest` or create a new environment with any manager 2. Open Environment Managers view 3. Expand environment manager node 4. New environment is not visible until manual refresh **After:** 1. Run `pipenv install pytest` or create a new environment with any manager 2. Open Environment Managers view 3. Expand environment manager node 4. New environment appears immediately The fix is minimal and targeted, modifying only 1 line of code in the `getChildren` method in `EnvManagerView`. Unit tests have been updated to validate the core logic for any manager type. Fixes #782. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: eleanorjboyd <[email protected]>
1 parent 16f04fb commit 5b29669

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/features/views/envManagersView.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ export class EnvManagerView implements TreeDataProvider<EnvTreeItem>, Disposable
9595
if (element.kind === EnvTreeItemKind.manager) {
9696
const manager = (element as EnvManagerTreeItem).manager;
9797
const views: EnvTreeItem[] = [];
98+
99+
// Refresh manager when expanded to pick up newly created environments
100+
await manager.refresh(undefined);
101+
98102
const envs = await manager.getEnvironments('all');
99103
envs.filter((e) => !e.group).forEach((env) => {
100104
const view = new PythonEnvTreeItem(env, element as EnvManagerTreeItem, this.selected.get(env.envId.id));

0 commit comments

Comments
 (0)