Web Architecture (vscode.dev)
Relevant source files
The following files were used as context for generating this wiki page:
- extensions/markdown-language-features/package.json
- extensions/github/package.json
- extensions/simple-browser/package.json
- extensions/github-authentication/package.json
- extensions/npm/package.json
- extensions/typescript-language-features/package.nls.json
- extensions/markdown-math/package.json
- extensions/html/package.json
The web-based architecture of Visual Studio Code, commonly known as vscode.dev, provides a lightweight yet powerful code editor experience directly in the browser. This architecture is fundamentally modular, relying on a collection of extensions specifically designed or adapted to run in a web environment. These extensions enable core functionalities ranging from language intelligence and source control integration to authentication and rendering complex file types.
The key to this architecture is the extension model, which allows extensions to declare their compatibility and entry points for a browser context. Features like virtualWorkspaces are crucial, enabling extensions to operate on file systems that are not backed by a local disk, such as a remote GitHub repository. This document outlines the core principles of the web extension model and details the key extensions that constitute the vscode.dev experience.
The Web Extension Model
An extension's package.json manifest is the central piece that declares its integration into the VS Code web environment. It contains specific fields that define how the extension behaves in a browser.
package.json Structure for Web
The manifest for a web-enabled extension must include specific properties to be loaded and activated correctly in the browser.
browserEntry Point: This property specifies the path to the extension's main JavaScript file compiled for the browser. It serves as an alternative to themainproperty, which is used for desktop (Node.js) environments.extensionKind: This property can be set to["ui", "workspace"]to indicate that the extension can run in both the UI and workspace contexts, a common pattern for web extensions.capabilities: This object declares the extension's ability to work in different environments.virtualWorkspaces: A value oftrueorlimitedindicates the extension is designed to work with virtual file systems, which is essential for features like opening a GitHub repository.untrustedWorkspaces: Defines how the extension behaves in a workspace that is not explicitly trusted by the user.
The following diagram illustrates the key fields in a package.json for a web-compatible extension.
This diagram shows the critical browser and capabilities fields that enable web functionality.
Sources: extensions/markdown-language-features/package.json:12, extensions/simple-browser/package.json:15, extensions/github-authentication/package.json:25
Extension Capabilities in a Web Environment
Support for virtual and untrusted workspaces varies across extensions, determining their functionality in vscode.dev.
| Extension | virtualWorkspaces | untrustedWorkspaces |
|---|---|---|
markdown-language-features | true | limited |
markdown-math | true | supported |
github-authentication | true | limited |
simple-browser | true | supported |
npm | limited | limited |
github | false | supported |
Sources: extensions/markdown-language-features/package.json:18-25, extensions/markdown-math/package.json:19-24, extensions/github-authentication/package.json:25-31, extensions/simple-browser/package.json:22-27, extensions/npm/package.json:30-36, extensions/github/package.json:19-24
Core Components of vscode.dev
The vscode.dev experience is powered by several key extensions that provide foundational features.
GitHub Integration
The github extension is central to the vscode.dev workflow, providing deep integration with GitHub repositories.
| Command | Description |
|---|---|
github.publish | Publish a workspace to a GitHub repository. |
github.copyVscodeDevLink | Copy a vscode.dev link to the current file and selection. |
github.openOnVscodeDev | Open the current repository in vscode.dev. |
Sources: extensions/github/package.json:33-52
A key feature is the ability to transition a session from a local environment to the web. The continueEditSession contribution point facilitates this.
This diagram shows the user flow for moving a working session to vscode.dev using the github extension.
Sources: extensions/github/package.json:54-61
Authentication
Secure access to resources like GitHub repositories is handled by the github-authentication extension. It provides authentication services for both GitHub.com and GitHub Enterprise.
It contributes to the authentication point, defining providers for github and github-enterprise. This extension is designed to work in a web environment, with its extensionKind set to ["ui", "workspace"] and full support for virtualWorkspaces.
Sources: extensions/github-authentication/package.json:22, extensions/github-authentication/package.json:33-46
Language Intelligence in the Browser
Language-specific features like IntelliSense, validation, and formatting are provided by extensions that can run in the browser.
TypeScript and JavaScript
The typescript-language-features extension provides rich language support for JS/TS in the web. It includes several configurations specifically for the web environment to manage performance and functionality.
| Configuration | Description |
|---|---|
typescript.tsserver.web.projectWideIntellisense.enabled | Enables or disables project-wide IntelliSense on the web. |
typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors | Suppresses semantic errors on the web, even with project-wide IntelliSense enabled. |
typescript.tsserver.web.typeAcquisition.enabled | Enables or disables automatic package type acquisition on the web for improved IntelliSense. |
Sources: extensions/typescript-language-features/package.nls.json:210-212
Markdown
The markdown-language-features extension is another example of a web-enabled language service. It declares a browser entry point (./dist/browser/extension) and supports virtualWorkspaces, allowing users to edit Markdown files in remote repositories. It also contributes a notebook renderer (vscode.markdown-it-renderer) that works in the web.
Sources: extensions/markdown-language-features/package.json:12, extensions/markdown-language-features/package.json:18, extensions/markdown-language-features/package.json:28-32
Integrated Simple Browser
The simple-browser extension provides the ability to open web links within a VS Code webview panel instead of an external browser tab. It activates on http and https URI schemes, making it a fundamental part of containing the user experience within vscode.dev.
Sources: extensions/simple-browser/package.json:19-21
Conclusion
The web architecture of VS Code (vscode.dev) is a sophisticated system that leverages the existing extension ecosystem by defining clear patterns for web compatibility. Through package.json manifest properties like browser entry points and capabilities, extensions can declare their ability to run in a browser and handle virtual file systems. Core extensions for GitHub integration, authentication, and language services form the backbone of this architecture, delivering a rich, browser-native development environment that is both powerful and accessible.