Skip to content

Conversation

@eleanorjboyd
Copy link
Member

@eleanorjboyd eleanorjboyd commented Dec 9, 2025

fixes #936

@eleanorjboyd eleanorjboyd added the bug Issue identified by VS Code Team member as probable bug label Dec 9, 2025
@eleanorjboyd eleanorjboyd requested a review from Copilot December 9, 2025 19:01
@eleanorjboyd eleanorjboyd marked this pull request as ready for review December 9, 2025 19:03
@vs-code-engineering vs-code-engineering bot added this to the December / January 2026 milestone Dec 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes environment variable caching issues (#936) by introducing proper tracking of injected environment variables per workspace. The implementation ensures that variables removed or commented out in .env files are properly cleaned up from the terminal environment, and that only tracked variables managed by this injector are removed (preserving variables set by other managers like BASH_ENV).

Key changes:

  • Added trackedEnvVars Map to track which environment variables are set per workspace
  • Refactored injection logic to compare previous and current state, deleting variables that are no longer present
  • Updated disposal logic to only clean up tracked variables instead of clearing all environment variables
  • Comprehensive test suite with both unit tests and integration tests using fixture files

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/features/terminal/terminalEnvVarInjector.ts Added tracking mechanism for environment variables per workspace, refactored injection and cleanup logic to handle variable removal, and improved dispose method to preserve non-tracked variables
src/test/features/terminalEnvVarInjectorBasic.unit.test.ts Comprehensive unit tests for core functionality including variable addition, updates, deletion, and tracking using test interface pattern for private method access
src/test/features/terminalEnvVarInjector.test.ts Integration tests using real file fixtures to verify complete workflows including file modifications, deletions, configuration changes, and multi-workspace scenarios
src/test/fixtures/terminalEnvVarInjector/*.env Test fixture files covering various scenarios: basic variables, empty files, commented variables, custom paths, unset values, and multi-workspace setups
.github/instructions/testing-workflow.instructions.md Added learnings about fixture-based testing, private access patterns, path handling consistency, and VS Code file watcher limitations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eleanorjboyd eleanorjboyd marked this pull request as draft December 9, 2025 19:09
@eleanorjboyd eleanorjboyd marked this pull request as ready for review December 10, 2025 04:57
@eleanorjboyd eleanorjboyd marked this pull request as draft December 10, 2025 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.env File no longer updates commented variables

1 participant