Skip to content

🐛 fire onDidChangePythonProjects event on project change#1642

Open
Yashraj-Jangra wants to merge 1 commit into
microsoft:mainfrom
Yashraj-Jangra:fix-ondidchange-projects
Open

🐛 fire onDidChangePythonProjects event on project change#1642
Yashraj-Jangra wants to merge 1 commit into
microsoft:mainfrom
Yashraj-Jangra:fix-ondidchange-projects

Conversation

@Yashraj-Jangra

Copy link
Copy Markdown

Fixes the issue where the public onDidChangePythonProjects API event never fired when projects were added or removed at runtime.

Cause

The public onDidChangePythonProjects emitter was declared in PythonEnvironmentApiImpl but was never actually fired. The API layer also wasn't subscribed to the project manager's internal project change events.

Changes

  • Exposed PythonEnvironmentApiImpl for unit testing.
  • Subscribed to projectManager.onDidChangeProjects in the constructor.
  • Added a private cache of previous projects to compute the delta (added and removed projects) on changes, firing the public event when projects are modified.

Verification

  • Added a unit test in src/test/features/pythonApi.unit.test.ts to verify the delta logic.
  • Added an integration test in src/test/integration/pythonProjects.integration.test.ts.
  • Verified all unit tests pass locally.

@Yashraj-Jangra

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant