@@ -396,27 +396,46 @@ export interface EnvironmentManager {
396396 * @param scope - The scope within which to create the environment.
397397 * @param options - Optional parameters for creating the Python environment.
398398 * @returns A promise that resolves to the created Python environment, or undefined if creation failed.
399+ *
400+ * @remarks
401+ * Called when the user:
402+ * - Runs the "Python: Create Environment" command (which prompts for a manager to use).
403+ * - Clicks the "+" button on an environment manager in the Python Environments view.
404+ * - Creates a new environment as part of the new Python package project creation wizard.
399405 */
400406 create ?( scope : CreateEnvironmentScope , options ?: CreateEnvironmentOptions ) : Promise < PythonEnvironment | undefined > ;
401407
402408 /**
403409 * Removes the specified Python environment.
404410 * @param environment - The Python environment to remove.
405411 * @returns A promise that resolves when the environment is removed.
412+ *
413+ * @remarks
414+ * Called when the user right-clicks an environment in the Python Environments tree view and selects
415+ * "Delete Environment".
406416 */
407417 remove ?( environment : PythonEnvironment ) : Promise < void > ;
408418
409419 /**
410420 * Refreshes the list of Python environments within the specified scope.
411421 * @param scope - The scope within which to refresh environments.
412422 * @returns A promise that resolves when the refresh is complete.
423+ *
424+ * @remarks
425+ * Called when the user clicks the refresh button in the Python Environments view title bar.
413426 */
414427 refresh ( scope : RefreshEnvironmentsScope ) : Promise < void > ;
415428
416429 /**
417430 * Retrieves a list of Python environments within the specified scope.
418431 * @param scope - The scope within which to retrieve environments.
419432 * @returns A promise that resolves to an array of Python environments.
433+ *
434+ * @remarks
435+ * Called when:
436+ * - The user expands an environment manager node in the Python Environments tree view.
437+ * - The user opens the environment picker to select an interpreter.
438+ * - Internally after {@link EnvironmentManager.refresh} completes, to count discovered environments.
420439 */
421440 getEnvironments ( scope : GetEnvironmentsScope ) : Promise < PythonEnvironment [ ] > ;
422441
@@ -430,13 +449,30 @@ export interface EnvironmentManager {
430449 * @param scope - The scope within which to set the environment.
431450 * @param environment - The Python environment to set. If undefined, the environment is unset.
432451 * @returns A promise that resolves when the environment is set.
452+ *
453+ * @remarks
454+ * Called when the user:
455+ * - Selects an environment in the environment picker or clicks the checkmark button in the tree view.
456+ * - Creates a new environment and the extension auto-selects it.
457+ *
458+ * Also called at extension startup during initial environment selection to cache the active
459+ * environment, and when a Python project is removed (with `environment` set to `undefined`).
433460 */
434461 set ( scope : SetEnvironmentScope , environment ?: PythonEnvironment ) : Promise < void > ;
435462
436463 /**
437464 * Retrieves the current Python environment within the specified scope.
438465 * @param scope - The scope within which to retrieve the environment.
439466 * @returns A promise that resolves to the current Python environment, or undefined if none is set.
467+ *
468+ * @remarks
469+ * Called when:
470+ * - The extension starts up, during initial environment selection for each workspace folder and global scope.
471+ * - After {@link EnvironmentManager.set}, to confirm the new active environment and fire change events.
472+ * - A terminal is opened or a command is run, to determine which Python environment to activate.
473+ * - The user runs a Python file ("Run in Terminal", "Run as Task"), to get the interpreter.
474+ * - The environment picker needs to display the currently selected (recommended) environment.
475+ * - Auto-discovery checks if a local venv already exists for a workspace folder.
440476 */
441477 get ( scope : GetEnvironmentScope ) : Promise < PythonEnvironment | undefined > ;
442478
@@ -456,13 +492,22 @@ export interface EnvironmentManager {
456492 *
457493 * @param context - The context for resolving the environment, which can be a {@link PythonEnvironment} or a {@link Uri}.
458494 * @returns A promise that resolves to the fully detailed {@link PythonEnvironment}, or `undefined` if the environment cannot be resolved.
495+ *
496+ * @remarks
497+ * Called when:
498+ * - The user browses for and selects a Python interpreter path via the file picker.
499+ * - The user has `python.defaultInterpreterPath` configured and the extension resolves it at startup.
500+ * - Before running a Python script ("Run in Terminal", "Run as Task"), to obtain full execution info.
459501 */
460502 resolve ( context : ResolveEnvironmentContext ) : Promise < PythonEnvironment | undefined > ;
461503
462504 /**
463505 * Clears the environment manager's cache.
464506 *
465507 * @returns A promise that resolves when the cache is cleared.
508+ *
509+ * @remarks
510+ * Called when the user runs the "Python: Clear Cache" command from the Command Palette.
466511 */
467512 clearCache ?( ) : Promise < void > ;
468513}
0 commit comments