Skip to content

docs: add @remarks to EnvironmentManager interface documenting when each method is called#1437

Open
StellaHuang95 wants to merge 4 commits intomicrosoft:mainfrom
StellaHuang95:moreDocs
Open

docs: add @remarks to EnvironmentManager interface documenting when each method is called#1437
StellaHuang95 wants to merge 4 commits intomicrosoft:mainfrom
StellaHuang95:moreDocs

Conversation

@StellaHuang95
Copy link
Copy Markdown
Contributor

Summary

Adds @remarks JSDoc sections to all methods on the EnvironmentManager interface, 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 EnvironmentManager know 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

@remarks sections on 8 methods of EnvironmentManager in both src/api.ts and pythonEnvironmentsApi/src/main.ts:

Method Trigger summary
create "Create Environment" command, "+" button in tree view, new package project wizard
remove Right-click → "Delete Environment" in tree view
refresh Refresh button in the Python Environments view title bar
getEnvironments Tree view expansion, environment picker, internally after refresh
set Environment picker selection, checkmark button in tree view, auto-select after create, startup caching, project removal
get Startup, after set, terminal activation, script execution, picker display, auto-discovery
resolve File picker interpreter selection, defaultInterpreterPath resolution, pre-run resolution
clearCache "Python: Clear Cache" command

Each remark was verified by tracing every call site through InternalEnvironmentManagerenvManagers.tsenvCommands.tsextension.ts command registrations and package.json menu contributions.

Who this helps

Extension authors building environment managers for tools like Hatch, Pixi, uv, etc. They can now hover over any EnvironmentManager method 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

@StellaHuang95 StellaHuang95 added the documentation Improvements or additions to documentation label Apr 3, 2026
@StellaHuang95 StellaHuang95 added the debt Code quality issues label Apr 3, 2026
@eleanorjboyd
Copy link
Copy Markdown
Member

will review - sorry for the delay

@eleanorjboyd eleanorjboyd requested a review from Copilot April 14, 2026 20:21
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds @remarks documentation to the EnvironmentManager interface to clarify which user actions / internal events trigger each method, helping third-party implementers understand lifecycle and call frequency.

Changes:

  • Added @remarks sections for 8 EnvironmentManager methods describing triggering UI actions and internal flows.
  • Mirrored the same documentation in both the internal (src/api.ts) and published (pythonEnvironmentsApi/src/main.ts) API surfaces.
Show a summary per file
File Description
src/api.ts Adds @remarks to EnvironmentManager methods documenting when each is invoked.
pythonEnvironmentsApi/src/main.ts Mirrors the same @remarks additions for the published API package.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread src/api.ts Outdated
Comment thread pythonEnvironmentsApi/src/main.ts Outdated
Comment thread src/api.ts Outdated
StellaHuang95 and others added 3 commits April 15, 2026 12:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@StellaHuang95
Copy link
Copy Markdown
Contributor Author

done addressing the comments

* @returns A promise that resolves when the environment is removed.
*
* @remarks
* Called when the user right-clicks an environment in the Python Environments tree view and selects
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this can also be called by another extension or elsewhere in the extension tho? I am worried about tying these so closely to their current implementations they will become stale quickly and then lead future agents astray

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

Labels

debt Code quality issues documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants