docs: add @remarks to EnvironmentManager interface documenting when each method is called#1437
Open
StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
Open
docs: add @remarks to EnvironmentManager interface documenting when each method is called#1437StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
@remarksJSDoc sections to all methods on theEnvironmentManagerinterface, documenting which user actions or internal events trigger each method. Changes are documentation-only — no functional changes.Motivation
Raised in #378: third-party extension authors implementing
EnvironmentManagerknow what each method does (the existing JSDoc covers that), but not when or why it gets called. For example,get()is described as "retrieves the current Python environment" — but there's no mention that it's called at extension startup, during terminal activation, before script execution, etc.This makes it hard for authors to reason about their implementation. They end up guessing at lifecycle behavior, which leads to bugs (e.g., not caching in
get()because they didn't realize it's called frequently).What's added
@remarkssections on 8 methods ofEnvironmentManagerin bothsrc/api.tsandpythonEnvironmentsApi/src/main.ts:createremoverefreshgetEnvironmentsrefreshsetgetset, terminal activation, script execution, picker display, auto-discoveryresolvedefaultInterpreterPathresolution, pre-run resolutionclearCacheEach remark was verified by tracing every call site through
InternalEnvironmentManager→envManagers.ts→envCommands.ts→extension.tscommand registrations andpackage.jsonmenu contributions.Who this helps
Extension authors building environment managers for tools like Hatch, Pixi, uv, etc. They can now hover over any
EnvironmentManagermethod in their IDE and see exactly what user actions will invoke it, making implementation decisions much clearer.Files changed
src/api.ts— internal API copy (+45 lines, documentation only)pythonEnvironmentsApi/src/main.ts— published API package (+45 lines, documentation only)Refs #378