# Visual Studio Code

**Visual Studio Code**（VS Code）是一款基于 Electron 的可扩展源代码编辑器，由微软开发，于 2015 年 4 月作为 [Visual Studio](https://www.edgepedia.org/zh/visual-studio) 集成开发环境的轻量级跨平台版本发布预览。<sup>[1](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)</sup> 此后，它在 Stack Overflow 的调查中连续五年成为使用最多的 IDE，并在 2025 年成为最受开发者青睐的 IDE。<sup>[2](https://survey.stackoverflow.co/2025/technology)</sup> 其源代码以 MIT 许可的 Code - OSS 项目形式发布，而实际发行的产品则是微软对该代码的分发版本，采用微软产品许可证，并包含专有附加组件。<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup>

| 关键事实 | 详情 |
|---|---|
| 首次预览 | 2015 年 4 月，微软将其描述为 Visual Studio 的轻量级跨平台版本<sup>[1](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)</sup> |
| 许可 | MIT 许可的 Code - OSS 源代码；品牌产品以微软产品许可证发行，包含远程开发和 VS Code 服务器等专有组件<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup> |
| 使用份额 | 2024 年受访开发者中占 74%；2025 年为 53.3%（26,143 份回答），连续五年成为使用最多的 IDE<sup>[4](https://stackoverflow.co/company/press/archive/stack-overflow-2024-developer-survey-gap-between-ai-use-trust/)</sup><sup> • </sup><sup>[2](https://survey.stackoverflow.co/2025/technology)</sup> |
| 应用市场 | 据微软称超过 100,000 个扩展，其中包括约 36,000 个语言专用扩展、13,000 个格式化工具和 9,400 个调试器<sup>[5](https://developer.microsoft.com/blog/celebrating-50-million-developers-the-journey-of-visual-studio-and-visual-studio-code/)</sup> |
| 用户 | 据微软的 Amanda Silver 称约 4,000 万名开发者；微软后来的一篇文章宣布 Visual Studio 与 VS Code 合计用户突破 5,000 万里程碑<sup>[1](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)</sup><sup> • </sup><sup>[5](https://developer.microsoft.com/blog/celebrating-50-million-developers-the-journey-of-visual-studio-and-visual-studio-code/)</sup> |
| 性能 | 显示界面约需 3.1 秒，语言服务器完全就绪约需 10 秒；打开一个窗口并加载 TypeScript 项目时约占用 680 MB 内存<sup>[6](https://kanopylabs.com/blog/zed-vs-cursor-vs-vscode)</sup> |
| AI | 集成 GitHub Copilot，免费档每月提供 2,000 次补全和 50 次对话请求；代理模式在专用的代理宿主进程中运行代理<sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup><sup> • </sup><sup>[8](https://code.visualstudio.com/docs/agents/concepts/agent-host)</sup> |

## 架构与工作原理

视配置而定，多个扩展宿主会同时运行，各自使用不同的运行时和位置：一个本地 Node.js 扩展宿主，与界面运行在同一台机器上；一个 Web 扩展宿主，运行在浏览器中；以及一个远程 Node.js 扩展宿主，运行在容器或远程机器内。<sup>[9](https://code.visualstudio.com/api/advanced-topics/extension-host)</sup>

**隔离与懒加载。** 扩展宿主的设计目的是防止扩展影响启动性能、拖慢界面操作或修改界面。<sup>[9](https://code.visualstudio.com/api/advanced-topics/extension-host)</sup> 扩展通过声明激活事件实现懒加载；例如 Markdown 扩展仅在用户打开 Markdown 文件时加载，从而避免不必要的 CPU 和内存消耗。<sup>[9](https://code.visualstudio.com/api/advanced-topics/extension-host)</sup> 这种隔离有其局限：与沙箱化的渲染进程不同，扩展宿主进程没有沙箱保护，可以访问宿主机上的 VS Code 数据和文件。<sup>[10](https://arxiv.org/html/2411.07479v1)</sup>

**语言服务器协议。** 在[语言服务器协议](https://www.edgepedia.org/zh/language-server-protocol)模型中，语言服务器的分析在进程外运行。验证一个文件可能需要解析大量文件、构建抽象语法树并执行静态分析，这些操作可能带来可观的 CPU 和内存开销，因此 VS Code 将语言服务器放在与编辑器分离的进程中运行。<sup>[11](https://github.com/microsoft/vscode-docs/blob/main/api/language-extensions/language-server-extension-guide.md)</sup> 语言服务器配置包含两部分：语言客户端，即一个可访问 VS Code API 的 [JavaScript](https://www.edgepedia.org/zh/javascript) 或 [TypeScript](https://www.edgepedia.org/zh/typescript) 扩展；以及语言服务器，即独立运行的分析工具。<sup>[11](https://github.com/microsoft/vscode-docs/blob/main/api/language-extensions/language-server-extension-guide.md)</sup> 微软制定了语言服务器协议（LSP），以标准化语言工具与代码编辑器之间的通信，使以 PHP、Python 或 Java 编写的服务器能够集成到多种工具中。<sup>[11](https://github.com/microsoft/vscode-docs/blob/main/api/language-extensions/language-server-extension-guide.md)</sup><sup> • </sup><sup>[12](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2017/extensibility/language-server-protocol?view=vs-2017)</sup> 该协议源自 TypeScript 服务器的协议，并借鉴 VS Code 语言 API 扩展了语言特性，底层基于 JSON-RPC。<sup>[12](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2017/extensibility/language-server-protocol?view=vs-2017)</sup> LSP 是一个开放、由社区驱动的协议，在 VS Code 社区内发展，由微软发起；IDE 等客户端只需理解该协议，而无需了解每种编程语言。<sup>[13](https://repositum.tuwien.at/handle/20.500.12708/191924?mode=full)</sup>

## 许可与开源状态

代码仓库与产品之间的区分是整个生态系统的核心。Code - OSS 仓库采用 MIT 许可；Visual Studio Code 是该仓库的分发版本，包含微软特定的定制内容，包括附加源代码和扩展，以传统的微软产品许可证发布。<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup> 一个 `product.json` 文件配置了应用市场集成、遥测密钥、更新服务 URL，以及允许使用提案 API 的扩展 ID 列表。<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup> 某些微软扩展（如 C#/.NET 调试器）和 Visual Studio Code 服务器以限制其仅可用于 Visual Studio 系列产品的许可证分发。<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup>

**分支产品与应用市场鸿沟。** 基于 Code - OSS 构建的替代产品无法访问 Visual Studio 应用市场，后者的条款明确禁止非微软产品连接，导致 VSCodium、Eclipse Theia、[Cursor](https://www.edgepedia.org/zh/cursor-coding-agent)、Windsurf、Kiro 和 Antigravity 无法访问微软的第一方扩展市场。<sup>[14](https://www.positioniseverything.net/vs-code-alternatives-whats-open-source-and-what-microsoft-wont-do/)</sup><sup> • </sup><sup>[15](https://bloom.security/blog/extension-resurrection)</sup> VSCodium 基于微软源代码构建 MIT 许可的社区二进制版本，禁用遥测，改用 [Eclipse 基金会](https://www.edgepedia.org/zh/eclipse-foundation)的 Open VSX 注册表，部分受限扩展可能无法使用。<sup>[14](https://www.positioniseverything.net/vs-code-alternatives-whats-open-source-and-what-microsoft-wont-do/)</sup> Open VSX 有所增长，但规模仍远小于微软市场：2024 年 3 月其托管 3,551 个扩展，而微软市场为 57,305 个，约占 6.2%，高于 2021 年 5 月的 912 对 23,262。<sup>[16](https://blog.raw.pm/en/FLOSS-version-of-vscode-and-extensions-gallery/)</sup>

## 扩展与生态系统

微软的周年文章称 VS Code 应用市场拥有超过 100,000 个扩展，其中包括约 36,000 个语言专用扩展、19,000 个代码片段集合、13,000 个格式化工具、13,000 个代码检查工具、9,400 个调试器和 8,700 个主题。<sup>[5](https://developer.microsoft.com/blog/celebrating-50-million-developers-the-journey-of-visual-studio-and-visual-studio-code/)</sup> 独立统计的数字较低：一项 2024 年的学术研究分析了 52,880 个扩展，而 2024 年 3 月的统计显示市场约有 57,305 个扩展。<sup>[10](https://arxiv.org/html/2411.07479v1)</sup><sup> • </sup><sup>[16](https://blog.raw.pm/en/FLOSS-version-of-vscode-and-extensions-gallery/)</sup>

**安全研究。** 这项针对 52,880 个扩展的研究发现，2,969 个（5.61%）扩展在五个类别中对开发者可能有害，累计安装量达 6.13 亿次。<sup>[10](https://arxiv.org/html/2411.07479v1)</sup> 另一项名为“扩展复活”的活动表明，超过 500,000 个端点通过 VS Code 应用市场和 Open VSX 面临零点击远程代码执行风险。<sup>[15](https://bloom.security/blog/extension-resurrection)</sup>

## 数据一览

使用调查显示 VS Code 遥遥领先于所有替代品。在 2024 年 Stack Overflow 调查中，74% 的开发者使用它，是最接近的替代品 Visual Studio（29%）的两倍多。<sup>[4](https://stackoverflow.co/company/press/archive/stack-overflow-2024-developer-survey-gap-between-ai-use-trust/)</sup> 2025 年，它连续第五年成为使用最多的 IDE，同时也是最受青睐的 IDE，在回答相关问题的受访者中使用率为 53.3%（26,143 份回答）；基于订阅的 AI 赋能 IDE 并未取代 Visual Studio 和 VS Code，二者连续第四年占据前两位。<sup>[2](https://survey.stackoverflow.co/2025/technology)</sup> 在一篇从业者对比文章中引用的另一项 2025 年开发环境调查显示，经常使用 VS Code 的受访者占 75.9%，专业人士中占 76.2%，而 Visual Studio 为 29.0%，[IntelliJ IDEA](https://www.edgepedia.org/zh/intellij-idea) 为 27.1%；数字差异反映了调查人群的不同。<sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup>

**用户数量。** 微软的 Amanda Silver 表示，该编辑器在全球约有 4,000 万名开发者使用；微软后来的一则公告庆祝 Visual Studio 与 VS Code 合计用户突破 5,000 万里程碑，因此这两个数字衡量的是不同对象。<sup>[1](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)</sup><sup> • </sup><sup>[5](https://developer.microsoft.com/blog/celebrating-50-million-developers-the-journey-of-visual-studio-and-visual-studio-code/)</sup>

**性能。** 在冷启动基准测试中，VS Code 显示界面耗时 3.1 秒，语言服务器完全就绪约需 10 秒，与 Cursor 相近（3.4 秒和约 11 秒），而 Zed 在 180 毫秒内打开，不到一秒即可编辑。<sup>[6](https://kanopylabs.com/blog/zed-vs-cursor-vs-vscode)</sup> 打开一个窗口并加载 TypeScript 项目时的稳态内存占用，VS Code 为 680 MB，Cursor 为 780 MB，而 Zed 为 240 MB；仅 Electron 外壳在打开项目前每个窗口就消耗约 400 至 700 MB，重度配置可将 Electron 编辑器的内存占用推高至每窗口 1.6 GB。<sup>[6](https://kanopylabs.com/blog/zed-vs-cursor-vs-vscode)</sup>

## AI 功能与近期变化

[GitHub Copilot](https://www.edgepedia.org/zh/github-copilot) 作为扩展集成，采用分级定价：Copilot 免费版每月提供 2,000 次补全和 50 次对话请求，Pro 版每月 10 美元，Pro+ 版 39 美元，Max 版 100 美元。<sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup> 在架构方面，VS Code 现在在称为代理宿主的独立进程中执行 AI 编码代理，并通过代理宿主协议（AHP）与之通信；该宿主自行管理代理会话，独立于展示和操作它们的客户端。<sup>[8](https://code.visualstudio.com/docs/agents/concepts/agent-host)</sup> 代理宿主可以作为本地工具进程运行，也可以作为远程机器上的独立服务器运行，本地 IPC 使用消息端口，远程连接使用基于 [WebSocket](https://www.edgepedia.org/zh/websocket) 的 AHP JSON-RPC；它位于工作区旁边，因此文件编辑和命令在包含该宿主的环境中运行。<sup>[8](https://code.visualstudio.com/docs/agents/concepts/agent-host)</sup> 该协议开放且不限定特定代理，使用 JSON-RPC 和不可变状态，并通过纯归约函数同步会话数据。<sup>[8](https://code.visualstudio.com/docs/agents/concepts/agent-host)</sup>

**分支产品冲突。** 2025 年 4 月，微软阻止 Cursor 等 VS Code 分支产品使用其 C/C++ 扩展；据称 Cursor 曾使用反向代理掩盖其对 Visual Studio 应用市场端点的网络请求，而其他分支产品则使用 Open VSX。<sup>[17](https://www.theregister.com/software/2025/04/24/microsoft-subtracts-c/c-extension-from-vs-code-forks/721912)</sup> 大约同时，微软在其 Copilot 软件中推出了代理模式。<sup>[17](https://www.theregister.com/software/2025/04/24/microsoft-subtracts-c/c-extension-from-vs-code-forks/721912)</sup> 一位身份不明的开发者请求美国联邦贸易委员会调查微软的反竞争行为，声称微软偏袒自家产品、随附 Copilot 且无法移除，并排斥 Cursor 等竞争对手，以将用户困在其 AI 生态系统中。<sup>[17](https://www.theregister.com/software/2025/04/24/microsoft-subtracts-c/c-extension-from-vs-code-forks/721912)</sup> 一项相关批评涉及提案 API，微软将其描述为不稳定并禁止市场发布的附加组件使用，但微软自家的扩展（如 GitHub Copilot Chat）却可以访问。<sup>[18](https://www.techzine.eu/news/devops/125562/microsoft-reacts-to-criticism-of-visual-studio-code-api-usage/)</sup>

## 与其他产品的比较

**Visual Studio** 是一款完整的 IDE，VS Code 最初是其轻量级跨平台补充；两者仍是同一系列下的不同产品。<sup>[1](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)</sup> **VSCodium** 提供 MIT 许可的二进制版本，禁用遥测，以 Open VSX 作为扩展来源，代价是缺少部分受限扩展和微软服务。<sup>[14](https://www.positioniseverything.net/vs-code-alternatives-whats-open-source-and-what-microsoft-wont-do/)</sup> **Cursor** 是一款闭源的 VS Code 分支产品，定期合并上游 VS Code 代码，并将代码数据发送至其服务器以提供 AI 功能；其隐私模式承诺不持久化代码数据，但这与代码从不离开用户计算机是两回事。其定价从免费的 Hobby 计划到每月 20 美元的 Pro、60 美元的 Pro Plus 和 200 美元的 Ultra。<sup>[14](https://www.positioniseverything.net/vs-code-alternatives-whats-open-source-and-what-microsoft-wont-do/)</sup><sup> • </sup><sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup> 在上述 2025 年调查中，Cursor 的使用率为 17.9%，Neovim 为 14.0%，Zed 为 7.3%。<sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup> **JetBrains** 因竞争压力改变了自己的许可模式：自 IntelliJ IDEA 2025.3 起，提供单一统一下载，核心功能对商业和非商业用途免费，取代了旧的社区版，个人 Ultimate 订阅首年 199 美元。<sup>[7](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)</sup>

## 遥测、隐私与批评

微软表示其收集匿名使用统计、调查数据和崩溃转储以改进产品质量，不收集任何个人身份信息；遥测收集可以禁用。<sup>[3](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)</sup> 扩展层面的收集则是另一回事。该学术研究识别出 46 个扩展主动监控并传输用户、设备、项目、会话、编码时间、IP 地址、用户操作、提交日志和会话详情等数据；其中 28 个未披露其跟踪行为。下载量达 425,386 次的 Code Time 扩展被发现会在用户不知情的情况下收集用户名、设备主机名、时区和详细的项目目录。<sup>[10](https://arxiv.org/html/2411.07479v1)</sup>

除遥测外，批评主要集中在应用市场的集中化、发行产品中故意的闭源组件、上述分支限制，以及 Electron 外壳的资源占用。<sup>[19](https://blogs.eclipse.org/post/thomas-froment/when-%E2%80%9Copen%E2%80%99t-open-enough-rethinking-trust-dev-tools)</sup><sup> • </sup><sup>[17](https://www.theregister.com/software/2025/04/24/microsoft-subtracts-c/c-extension-from-vs-code-forks/721912)</sup><sup> • </sup><sup>[6](https://kanopylabs.com/blog/zed-vs-cursor-vs-vscode)</sup>

## References

1. [Visual Studio Code helped Microsoft win developers. New AI coding editors want to own the future, The Stack](https://www.thestack.technology/visual-studio-code-helped-microsoft-win-developers-new-ai-coding-editors-want-to-own-the-future/)
2. [Technology, 2025 Stack Overflow Developer Survey](https://survey.stackoverflow.co/2025/technology)
3. [Differences between the repository and Visual Studio Code, microsoft/vscode Wiki](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)
4. [Stack Overflow's 2024 Developer Survey press release](https://stackoverflow.co/company/press/archive/stack-overflow-2024-developer-survey-gap-between-ai-use-trust/)
5. [Celebrating 50 Million Developers: The Journey of Visual Studio and Visual Studio Code, Microsoft](https://developer.microsoft.com/blog/celebrating-50-million-developers-the-journey-of-visual-studio-and-visual-studio-code/)
6. [Zed vs Cursor vs VS Code: AI-Native Code Editors for 2026, Kanopy Labs](https://kanopylabs.com/blog/zed-vs-cursor-vs-vscode)
7. [Best IDEs for Developers in 2026: VS Code vs JetBrains vs Cursor vs Zed, DevHunt](https://devhunt.org/blog/comparing-popular-ide-tools-for-developers)
8. [VS Code Agent Host architecture, Visual Studio Code documentation](https://code.visualstudio.com/docs/agents/concepts/agent-host)
9. [Extension Host, Visual Studio Code Extension API](https://code.visualstudio.com/api/advanced-topics/extension-host)
10. [Developers Are Victims Too: A Comprehensive Analysis of The VS Code Extension Ecosystem, arXiv](https://arxiv.org/html/2411.07479v1)
11. [Language Server Extension Guide, vscode-docs](https://github.com/microsoft/vscode-docs/blob/main/api/language-extensions/language-server-extension-guide.md)
12. [Language Server Protocol, Microsoft Learn](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2017/extensibility/language-server-protocol?view=vs-2017)
13. [Language Server Protocol: An Introduction to the Protocol, its Use, and Adoption for Web Modeling Tools, TU Wien](https://repositum.tuwien.at/handle/20.500.12708/191924?mode=full)
14. [VS Code Alternatives: VSCodium, Cursor, Void and Code - OSS, Position Is Everything](https://www.positioniseverything.net/vs-code-alternatives-whats-open-source-and-what-microsoft-wont-do/)
15. [Extension Resurrection: Zero-Click RCE over 500k endpoints using VS Code Marketplace and Open VSX, Bloom Security](https://bloom.security/blog/extension-resurrection)
16. [FLOSS version of VSCode and the extensions gallery, Rawsec](https://blog.raw.pm/en/FLOSS-version-of-vscode-and-extensions-gallery/)
17. [Microsoft subtracts C/C++ extension from VS Code forks, The Register](https://www.theregister.com/software/2025/04/24/microsoft-subtracts-c/c-extension-from-vs-code-forks/721912)
18. [Microsoft reacts to criticism of Visual Studio Code API usage, Techzine](https://www.techzine.eu/news/devops/125562/microsoft-reacts-to-criticism-of-visual-studio-code-api-usage/)
19. [When "Open" Isn't Open Enough: Rethinking Trust in Dev Tools, Eclipse Foundation Blog](https://blogs.eclipse.org/post/thomas-froment/when-%E2%80%9Copen%E2%80%99t-open-enough-rethinking-trust-dev-tools)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Development tools and collaboration infrastructure › Build, deployment, and development tooling

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/visual-studio-code

English original: https://www.edgepedia.org/visual-studio-code
