# powershell/vscode-powershell architecture

> Architecture diagram of the GitHub repository powershell/vscode-powershell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/powershell/vscode-powershell
- Repository: https://github.com/powershell/vscode-powershell

## Overview

PowerShell for VS Code is an LSP client extension: a user works in VS Code, the extension starts a PowerShell process and connects to PowerShell Editor Services, then exposes language, terminal, and debugging capabilities through VS Code. The graph preserves documented capabilities whose implementation was not sampled. Source excerpts show session/process setup and feature registrations/imports, but not every runtime call between features and the language client; those internal links are omitted rather than inferred.

Main entry points: [`src/extension.ts`](https://github.com/powershell/vscode-powershell/blob/main/src/extension.ts) (Extension activation), [`src/session.ts`](https://github.com/powershell/vscode-powershell/blob/main/src/session.ts) (Session manager), [`src/process.ts`](https://github.com/powershell/vscode-powershell/blob/main/src/process.ts) (PowerShell process), [`src/platform.ts`](https://github.com/powershell/vscode-powershell/blob/main/src/platform.ts) (PowerShell discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Extension lifecycle"]
  node_extension["Extension activation<br/>[extension.ts]"]
  node_session["Session manager<br/>[session.ts]"]
  node_process["PowerShell process<br/>[process.ts]"]
  node_platform["PowerShell discovery<br/>[platform.ts]"]
  node_settings["Settings and cwd<br/>[settings.ts]"]
  node_logger["Logging<br/>[logging.ts]"]
end

subgraph group_language["Language features"]
  node_languageclient["Language client readiness"]
  node_codeactions["Code actions<br/>[CodeActions.ts]"]
  node_alias["Alias expansion<br/>[ExpandAlias.ts]"]
  node_completion["Help completion<br/>[HelpCompletion.ts]"]
  node_commands["Command explorer<br/>[GetCommands.ts]"]
  node_help["Help viewer<br/>[ShowHelp.ts]"]
  node_languagefeatures["Language intelligence"]
  node_syntaxsnippets["Syntax and snippets<br/>[PowerShell.json]"]
  node_language_tools["Language model tools"]
end

subgraph group_interaction["User interaction"]
  node_console["Extension terminal<br/>[Console.ts]"]
  node_editorcommands["Editor commands"]
  node_debug["Debugger integration<br/>[DebugSession.ts]"]
  node_isesupport["ISE compatibility"]
  node_remote["Remote files<br/>[RemoteFiles.ts]"]
  node_pester["Pester test integration<br/>[PesterTests.ts]"]
  node_update["PowerShell update"]
  node_externalapi["External API<br/>[ExternalApi.ts]"]
end

subgraph group_runtime["PowerShell runtime"]
end

node_user(("VS Code user"))
node_vscode["Visual Studio Code"]
node_editorservices["PowerShell Editor Services"]
node_powershell["PowerShell engine"]

node_user -->|"uses"| node_vscode
node_vscode -->|"activates"| node_extension
node_extension -->|"creates"| node_session
node_session -->|"discovers"| node_platform
node_session -->|"starts"| node_process
node_process -->|"validates cwd"| node_settings
node_platform -->|"updates"| node_settings
node_extension -->|"creates"| node_logger
node_session -->|"connects"| node_editorservices
node_process -.->|"launches"| node_powershell
node_editorservices -->|"uses"| node_powershell
node_extension -->|"registers consumers"| node_languageclient
node_session -->|"signals client lifecycle"| node_languageclient
node_extension -->|"registers"| node_codeactions
node_extension -->|"registers"| node_alias
node_extension -->|"registers"| node_completion
node_extension -->|"registers"| node_commands
node_extension -->|"registers"| node_help
node_extension -->|"registers"| node_console
node_extension -->|"registers"| node_editorcommands
node_extension -->|"registers"| node_debug
node_extension -->|"registers"| node_isesupport
node_extension -->|"registers"| node_remote
node_extension -->|"registers"| node_pester
node_extension -.->|"registers"| node_update
node_extension -.->|"registers"| node_externalapi
node_extension -.->|"registers"| node_language_tools
node_vscode -->|"provides"| node_languagefeatures
node_vscode -->|"uses"| node_syntaxsnippets
node_languagefeatures -->|"requests language services"| node_editorservices
node_user -->|"runs selection"| node_console
node_user -->|"starts debugging"| node_debug

click node_extension "https://github.com/powershell/vscode-powershell/blob/main/src/extension.ts"
click node_session "https://github.com/powershell/vscode-powershell/blob/main/src/session.ts"
click node_process "https://github.com/powershell/vscode-powershell/blob/main/src/process.ts"
click node_platform "https://github.com/powershell/vscode-powershell/blob/main/src/platform.ts"
click node_settings "https://github.com/powershell/vscode-powershell/blob/main/src/settings.ts"
click node_logger "https://github.com/powershell/vscode-powershell/blob/main/src/logging.ts"
click node_languageclient "https://github.com/powershell/vscode-powershell/blob/main/src/languageClientConsumer.ts"
click node_codeactions "https://github.com/powershell/vscode-powershell/blob/main/src/features/CodeActions.ts"
click node_alias "https://github.com/powershell/vscode-powershell/blob/main/src/features/ExpandAlias.ts"
click node_completion "https://github.com/powershell/vscode-powershell/blob/main/src/features/HelpCompletion.ts"
click node_commands "https://github.com/powershell/vscode-powershell/blob/main/src/features/GetCommands.ts"
click node_help "https://github.com/powershell/vscode-powershell/blob/main/src/features/ShowHelp.ts"
click node_console "https://github.com/powershell/vscode-powershell/blob/main/src/features/Console.ts"
click node_editorcommands "https://github.com/powershell/vscode-powershell/blob/main/src/features/ExtensionCommands.ts"
click node_debug "https://github.com/powershell/vscode-powershell/blob/main/src/features/DebugSession.ts"
click node_syntaxsnippets "https://github.com/powershell/vscode-powershell/blob/main/snippets/PowerShell.json"
click node_isesupport "https://github.com/powershell/vscode-powershell/blob/main/src/features/ISECompatibility.ts"
click node_remote "https://github.com/powershell/vscode-powershell/blob/main/src/features/RemoteFiles.ts"
click node_pester "https://github.com/powershell/vscode-powershell/blob/main/src/features/PesterTests.ts"
click node_update "https://github.com/powershell/vscode-powershell/blob/main/src/features/UpdatePowerShell.ts"
click node_externalapi "https://github.com/powershell/vscode-powershell/blob/main/src/features/ExternalApi.ts"
click node_language_tools "https://github.com/powershell/vscode-powershell/blob/main/src/features/LanguageModelTools.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extension,node_session,node_process,node_platform,node_settings,node_logger,node_user toneBlue
class node_languageclient,node_codeactions,node_alias,node_completion,node_commands,node_help,node_languagefeatures,node_syntaxsnippets,node_language_tools toneAmber
class node_console,node_editorcommands,node_debug,node_isesupport,node_remote,node_pester,node_update,node_externalapi toneMint
class node_vscode,node_editorservices,node_powershell toneIndigo
```

## Components

### Extension lifecycle

- [Extension activation](https://github.com/powershell/vscode-powershell/blob/main/src/extension.ts): `src/extension.ts`
- [Session manager](https://github.com/powershell/vscode-powershell/blob/main/src/session.ts): `src/session.ts`
- [PowerShell process](https://github.com/powershell/vscode-powershell/blob/main/src/process.ts): `src/process.ts`
- [PowerShell discovery](https://github.com/powershell/vscode-powershell/blob/main/src/platform.ts): `src/platform.ts`
- [Settings and cwd](https://github.com/powershell/vscode-powershell/blob/main/src/settings.ts): `src/settings.ts`
- [Logging](https://github.com/powershell/vscode-powershell/blob/main/src/logging.ts): `src/logging.ts`

### Language features

- [Language client readiness](https://github.com/powershell/vscode-powershell/blob/main/src/languageClientConsumer.ts): `src/languageClientConsumer.ts`
- [Code actions](https://github.com/powershell/vscode-powershell/blob/main/src/features/CodeActions.ts): `src/features/CodeActions.ts`
- [Alias expansion](https://github.com/powershell/vscode-powershell/blob/main/src/features/ExpandAlias.ts): `src/features/ExpandAlias.ts`
- [Help completion](https://github.com/powershell/vscode-powershell/blob/main/src/features/HelpCompletion.ts): `src/features/HelpCompletion.ts`
- [Command explorer](https://github.com/powershell/vscode-powershell/blob/main/src/features/GetCommands.ts): `src/features/GetCommands.ts`
- [Help viewer](https://github.com/powershell/vscode-powershell/blob/main/src/features/ShowHelp.ts): `src/features/ShowHelp.ts`
- **Language intelligence**
- [Syntax and snippets](https://github.com/powershell/vscode-powershell/blob/main/snippets/PowerShell.json): `snippets/PowerShell.json`
- [Language model tools](https://github.com/powershell/vscode-powershell/blob/main/src/features/LanguageModelTools.ts): `src/features/LanguageModelTools.ts`

### User interaction

- [Extension terminal](https://github.com/powershell/vscode-powershell/blob/main/src/features/Console.ts): `src/features/Console.ts`
- [Editor commands](https://github.com/powershell/vscode-powershell/blob/main/src/features/ExtensionCommands.ts): `src/features/ExtensionCommands.ts`
- [Debugger integration](https://github.com/powershell/vscode-powershell/blob/main/src/features/DebugSession.ts): `src/features/DebugSession.ts`
- [ISE compatibility](https://github.com/powershell/vscode-powershell/blob/main/src/features/ISECompatibility.ts): `src/features/ISECompatibility.ts`
- [Remote files](https://github.com/powershell/vscode-powershell/blob/main/src/features/RemoteFiles.ts): `src/features/RemoteFiles.ts`
- [Pester test integration](https://github.com/powershell/vscode-powershell/blob/main/src/features/PesterTests.ts): `src/features/PesterTests.ts`
- [PowerShell update](https://github.com/powershell/vscode-powershell/blob/main/src/features/UpdatePowerShell.ts): `src/features/UpdatePowerShell.ts`
- [External API](https://github.com/powershell/vscode-powershell/blob/main/src/features/ExternalApi.ts): `src/features/ExternalApi.ts`

### Other components

- **VS Code user**
- **Visual Studio Code**
- **PowerShell Editor Services**
- **PowerShell engine**

## Connections

- VS Code user → Visual Studio Code: uses (evidence: `README.md`)
- Visual Studio Code → Extension activation: activates (evidence: `src/extension.ts`)
- Extension activation → Session manager: creates (evidence: `src/extension.ts`)
- Session manager → PowerShell discovery: discovers (evidence: `src/session.ts`)
- Session manager → PowerShell process: starts (evidence: `src/session.ts`)
- PowerShell process → Settings and cwd: validates cwd (evidence: `src/process.ts`)
- PowerShell discovery → Settings and cwd: updates (evidence: `src/platform.ts`)
- Extension activation → Logging: creates (evidence: `src/extension.ts`)
- Session manager → PowerShell Editor Services: connects (evidence: `README.md`)
- PowerShell process → PowerShell engine: launches
- PowerShell Editor Services → PowerShell engine: uses (evidence: `README.md`)
- Extension activation → Language client readiness: registers consumers (evidence: `src/extension.ts`)
- Session manager → Language client readiness: signals client lifecycle (evidence: `src/session.ts`)
- Extension activation → Code actions: registers (evidence: `src/extension.ts`)
- Extension activation → Alias expansion: registers (evidence: `src/extension.ts`)
- Extension activation → Help completion: registers (evidence: `src/extension.ts`)
- Extension activation → Command explorer: registers (evidence: `src/extension.ts`)
- Extension activation → Help viewer: registers (evidence: `src/extension.ts`)
- Extension activation → Extension terminal: registers (evidence: `src/extension.ts`)
- Extension activation → Editor commands: registers (evidence: `src/extension.ts`)
- Extension activation → Debugger integration: registers (evidence: `src/extension.ts`)
- Extension activation → ISE compatibility: registers (evidence: `src/extension.ts`)
- Extension activation → Remote files: registers (evidence: `src/extension.ts`)
- Extension activation → Pester test integration: registers (evidence: `src/extension.ts`)
- Extension activation → PowerShell update: registers
- Extension activation → External API: registers (evidence: `src/extension.ts`)
- Extension activation → Language model tools: registers (evidence: `src/extension.ts`)
- Visual Studio Code → Language intelligence: provides (evidence: `README.md`)
- Visual Studio Code → Syntax and snippets: uses (evidence: `README.md`)
- Language intelligence → PowerShell Editor Services: requests language services (evidence: `README.md`)
- VS Code user → Extension terminal: runs selection (evidence: `README.md`)
- VS Code user → Debugger integration: starts debugging (evidence: `README.md`)
