mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-08 17:54:23 +01:00
* agentHost: add Claude and Codex session telemetry Generalize Agent Host subscription telemetry across providers while preserving Copilot-specific SDK resume dimensions. Add coverage for Claude, Codex, and future providers.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: filter session telemetry by registered provider Resolve subscription providers through the provider service so future registered providers are included while terminal and unknown resource schemes are excluded.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: use canonical provider service interface Keep the production dependency typed as IAgentHostProviderService and move partial service stubbing into test code.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: require canonical injected service interfaces Document that production service dependencies use their canonical interfaces and keep partial test conveniences in test code.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2.8 KiB
2.8 KiB
description, applyTo
| description | applyTo |
|---|---|
| VS Code source code organization — layers, target environments, dependency injection, and folder structure conventions. Reference when adding new modules, services, or contributions. | src/vs/** |
Source Code Organization
Canonical reference: https://github.com/microsoft/vscode/wiki/Source-Code-Organization
Layers
The src/vs/ core is partitioned into ordered layers — each may only import from layers below it:
base— General utilities and UI building blocks (no service dependencies)platform— Service injection support and base services shared across layerseditor— Monaco Editor core (nonodeorelectron-*dependencies)workbench— Full VS Code workbench, panels, views, and frameworkcode— Desktop app entry point (Electron main, shared process, CLI)server— Server app entry point for remote developmentsessions— Agent Sessions window (may import fromworkbenchand below;workbenchmust never import fromsessions)
Target Environments
Within each layer, code is organized by runtime environment:
| Folder | APIs Available | May Use |
|---|---|---|
common |
Basic JavaScript only | — |
browser |
Web/DOM APIs | common |
node |
Node.js APIs | common |
electron-browser |
Browser + limited Electron IPC | common, browser |
electron-utility |
Electron utility process | common, node |
electron-main |
Electron main process | common, node, electron-utility |
Workbench Organization
vs/workbench/{common|browser|electron-browser}— minimal workbench corevs/workbench/api—vscode.d.tsAPI providervs/workbench/services— core services (not contrib-specific)vs/workbench/contrib— feature contributions
Contribution Rules
- No dependency from outside
contrib/intocontrib/ - Each contribution has a single
.contribution.tsentry point - Contributions expose internal API from a single common file
- Cross-contribution dependencies use that common API — never reach into internals
Entry Points
Only code referenced from entry point files is loaded:
workbench.common.main.ts— shared dependenciesworkbench.desktop.main.ts— desktop-onlyworkbench.web.main.ts— web-only
Dependency Injection
Services are consumed via constructor injection with decorator identifiers:
class MyComponent {
constructor(@IMyService private readonly myService: IMyService) { }
}
Decorated service parameters must use their canonical service interface. Do not invent local subset interfaces or Pick<...> aliases in production to simplify tests; keep partial stubs, adapters, and other test-only conveniences in test code.
Services are provided via registerSingleton(IMyService, MyServiceImpl, InstantiationType.Delayed).