@@ -343,6 +343,14 @@ export interface QuickCreateConfig {
343343
344344/**
345345 * Interface representing an environment manager.
346+ *
347+ * @remarks
348+ * Methods on this interface are invoked both by the Python Environments extension itself
349+ * (in response to UI actions, startup, terminal activation, script execution, and so on)
350+ * and directly by other extensions that consume the published API. Any "called when…"
351+ * notes on individual methods list representative triggers only — they are not
352+ * exhaustive, and the precise set of call sites may evolve over time. Implementations
353+ * should focus on the documented contract rather than any specific caller.
346354 */
347355export interface EnvironmentManager {
348356 /**
@@ -396,27 +404,44 @@ export interface EnvironmentManager {
396404 * @param scope - The scope within which to create the environment.
397405 * @param options - Optional parameters for creating the Python environment.
398406 * @returns A promise that resolves to the created Python environment, or undefined if creation failed.
407+ *
408+ * @remarks
409+ * Invoked when an environment of this manager's type should be created for the given
410+ * scope. Typical triggers include user-initiated environment-creation flows and
411+ * programmatic creation via the API.
399412 */
400413 create ?( scope : CreateEnvironmentScope , options ?: CreateEnvironmentOptions ) : Promise < PythonEnvironment | undefined > ;
401414
402415 /**
403416 * Removes the specified Python environment.
404417 * @param environment - The Python environment to remove.
405418 * @returns A promise that resolves when the environment is removed.
419+ *
420+ * @remarks
421+ * Invoked to delete the given environment. Typical triggers include an explicit user
422+ * action (such as a "Delete Environment" command) and programmatic removal via the API.
406423 */
407424 remove ?( environment : PythonEnvironment ) : Promise < void > ;
408425
409426 /**
410427 * Refreshes the list of Python environments within the specified scope.
411428 * @param scope - The scope within which to refresh environments.
412429 * @returns A promise that resolves when the refresh is complete.
430+ *
431+ * @remarks
432+ * Forces the manager to re-discover environments for the given scope. Typically
433+ * triggered by an explicit user "refresh" action.
413434 */
414435 refresh ( scope : RefreshEnvironmentsScope ) : Promise < void > ;
415436
416437 /**
417438 * Retrieves a list of Python environments within the specified scope.
418439 * @param scope - The scope within which to retrieve environments.
419440 * @returns A promise that resolves to an array of Python environments.
441+ *
442+ * @remarks
443+ * Returns the environments known to this manager for the given scope. Called
444+ * frequently by UI surfaces (tree views, pickers) and by other consumers of the API.
420445 */
421446 getEnvironments ( scope : GetEnvironmentsScope ) : Promise < PythonEnvironment [ ] > ;
422447
@@ -430,13 +455,27 @@ export interface EnvironmentManager {
430455 * @param scope - The scope within which to set the environment.
431456 * @param environment - The Python environment to set. If undefined, the environment is unset.
432457 * @returns A promise that resolves when the environment is set.
458+ *
459+ * @remarks
460+ * Invoked when the active environment for the given scope should change — for example
461+ * after the user selects an environment in a picker, after a newly created environment
462+ * is auto-selected, or programmatically via the API.
463+ *
464+ * Also invoked at extension startup to rehydrate the active environment from
465+ * persisted state.
433466 */
434467 set ( scope : SetEnvironmentScope , environment ?: PythonEnvironment ) : Promise < void > ;
435468
436469 /**
437470 * Retrieves the current Python environment within the specified scope.
438471 * @param scope - The scope within which to retrieve the environment.
439472 * @returns A promise that resolves to the current Python environment, or undefined if none is set.
473+ *
474+ * @remarks
475+ * Returns the currently active environment for the given scope, or `undefined` if
476+ * none is selected. Called very frequently — at startup, after {@link set}, when a
477+ * terminal is opened, before running Python, by UI surfaces that display the active
478+ * interpreter, and by other extensions consuming the API.
440479 */
441480 get ( scope : GetEnvironmentScope ) : Promise < PythonEnvironment | undefined > ;
442481
@@ -456,13 +495,27 @@ export interface EnvironmentManager {
456495 *
457496 * @param context - The context for resolving the environment, which can be a {@link PythonEnvironment} or a {@link Uri}.
458497 * @returns A promise that resolves to the fully detailed {@link PythonEnvironment}, or `undefined` if the environment cannot be resolved.
498+ *
499+ * @remarks
500+ * Called to turn a lightly-populated {@link PythonEnvironment} or a {@link Uri}
501+ * pointing at an interpreter or environment folder into a fully-populated
502+ * {@link PythonEnvironment} with complete {@link PythonEnvironment.execInfo}. Typical
503+ * triggers include the user manually selecting an interpreter path, resolving
504+ * `python.defaultInterpreterPath` at startup, and populating execution details before
505+ * launching Python.
459506 */
460507 resolve ( context : ResolveEnvironmentContext ) : Promise < PythonEnvironment | undefined > ;
461508
462509 /**
463510 * Clears the environment manager's cache.
464511 *
465512 * @returns A promise that resolves when the cache is cleared.
513+ *
514+ * @remarks
515+ * Drops any cached environment data held by the manager so that subsequent calls to
516+ * {@link EnvironmentManager.getEnvironments} or {@link EnvironmentManager.get}
517+ * re-discover state from disk. Typically triggered by an explicit user "clear cache"
518+ * action.
466519 */
467520 clearCache ?( ) : Promise < void > ;
468521}
0 commit comments