Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 6 个月前 | ||
| 9 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 7 年前 | ||
| 7 个月前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 9 年前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 6 年前 | ||
| 6 个月前 | ||
| 1 年前 | ||
| 6 个月前 | ||
| 9 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 9 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 4 年前 |
OpenVSCode Server
这是什么?
本项目提供了一个可在远程机器上运行服务器并通过现代网页浏览器访问的 VS Code 版本。它基于 Gitpod 或 GitHub Codespaces 在大规模场景中使用的同一架构。

为什么开发此项目?
VS Code 传统上是一款使用 Web 技术构建的桌面 IDE。几年前,人们开始对其进行补丁修改,以便能在远程环境中运行并通过网页浏览器访问。这些尝试过程复杂且容易出错,因为需要对 VS Code 庞大的代码库进行多处修改。
幸运的是,在 2019 年,VS Code 团队开始重构其架构,以支持基于浏览器的工作模式。虽然此架构已被 Gitpod 和 GitHub 采用,但其中的关键部分直到现在才开源。因此,社区中许多人仍在使用旧的、难以维护且易错的方法。
在 Gitpod,我们经常被问到我们是如何实现的。因此我们认为,不如分享实现这一目标所需的最小修改集合,这样大家就能依赖最新版本的 VS Code,拥有清晰的升级路径并减少维护工作。
快速开始
Docker
- 启动服务器:
docker run -it --init -p 3000:3000 -v "$(pwd):/home/workspace:cached" gitpod/openvscode-server
- 访问终端中打印的 URL。
注意:欢迎使用 nightly 标签测试最新版本,例如 gitpod/openvscode-server:nightly。
自定义环境
- 如果你想向此 Docker 镜像添加依赖项,以下是一个辅助模板:
FROM gitpod/openvscode-server:latest USER root # 获取安装软件等操作的权限 RUN # 所需软件的安装过程 USER openvscode-server # 恢复 Web 界面的权限 - 如需更多可能性,请查阅 OpenVSCode Server 的
Dockerfile,地址为 https://github.com/gitpod-io/openvscode-releases/
预安装 VSCode 扩展
你可以通过以下方式预安装 vscode 扩展:
FROM gitpod/openvscode-server:latest
ENV OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"
ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server"
SHELL ["/bin/bash", "-c"]
RUN \
# Direct download links to external .vsix not available on https://open-vsx.org/
# The two links here are just used as example, they are actually available on https://open-vsx.org/
urls=(\
https://github.com/rust-lang/rust-analyzer/releases/download/2022-12-26/rust-analyzer-linux-x64.vsix \
https://github.com/VSCodeVim/Vim/releases/download/v1.24.3/vim-1.24.3.vsix \
)\
# Create a tmp dir for downloading
&& tdir=/tmp/exts && mkdir -p "${tdir}" && cd "${tdir}" \
# Download via wget from $urls array.
&& wget "${urls[@]}" && \
# List the extensions in this array
exts=(\
# From https://open-vsx.org/ registry directly
gitpod.gitpod-theme \
# From filesystem, .vsix that we downloaded (using bash wildcard '*')
"${tdir}"/* \
)\
# Install the $exts
&& for ext in "${exts[@]}"; do ${OPENVSCODE} --install-extension "${ext}"; done
Linux
-
解压缩并运行服务器
tar -xzf openvscode-server-v${OPENVSCODE_SERVER_VERSION}.tar.gz cd openvscode-server-v${OPENVSCODE_SERVER_VERSION} ./bin/openvscode-server # 您可以在此处添加参数,使用 --help 列出所有可能的选项在可能的入口点参数中,最值得注意的有
--port- 服务器启动时使用的端口号,默认为 3000--without-connection-token- 在 docker 镜像中默认使用--connection-token和--connection-token-file用于保护对 IDE 的访问,您可以在 保护 IDE 访问安全 中了解更多相关信息。--host- 确定服务器监听的主机。默认为localhost,因此若要进行远程访问,建议在启动参数中添加--host 0.0.0.0。
-
访问终端中打印的 URL。
注意:您可以使用 预发布版本 来测试夜间变更。
保护 IDE 访问安全
从 OpenVSCode Server v1.64 开始,您可以无需身份验证即可访问 Web UI(任何人只需使用主机名和端口即可访问 IDE)。如果您需要某种基本身份验证,可以使用 --connection-token YOUR_TOKEN 启动服务器。所提供的 YOUR_TOKEN 将被使用,启动服务器后,经过身份验证的 URL 将显示在终端中。您也可以创建一个纯文本文件,将所需令牌作为其内容,并通过 --connection-token-file YOUR_SECRET_TOKEN_FILE 将其提供给服务器。
如果您希望使用连接令牌,并且通过 Docker 镜像 使用 OpenVSCode Server,则必须编辑 Dockerfile 中的 ENTRYPOINT,或者在使用 docker-compose 时通过 entrypoint 选项 对其进行修改。
部署指南
请参考指南,了解如何将 OpenVSCode Server 部署到您选择的云服务提供商。
项目范围
本项目仅添加在服务器场景下运行 VS Code 所需的最少量组件。我们无意以任何方式修改 VS Code 本身,也不会为 VS Code 添加额外功能。功能请求、错误修复等问题,请向上游仓库反馈。
对于任何不特定于在服务器环境中运行 VS Code 的功能请求、错误报告或贡献,请前往 Visual Studio Code - Open Source "OSS"
文档
所有文档均位于本项目的docs分支。
支持者
本项目得到了多家公司的支持,例如 GitLab、VMware、Uber、SAP、Sourcegraph、RStudio、SUSE、Tabnine、Render 和 TypeFox。
贡献
感谢您对为本项目做出贡献感兴趣 🙏。您可以通过以下按钮启动开发环境:
要了解代码结构以及其他与贡献相关的主题,请参考开发文档。
捆绑扩展
VS Code 包含一组内置扩展,位于extensions文件夹中,包括多种语言的语法和代码片段。为某种语言提供丰富语言支持(内联建议、转到定义)的扩展带有后缀language-features。例如,json扩展为JSON提供语法着色,而json-language-features扩展为JSON提供丰富的语言支持。
开发容器
本仓库包含一个 Visual Studio Code 开发容器 / GitHub Codespaces 开发容器。
- 对于 Dev Containers,请使用 Dev Containers: Clone Repository in Container Volume... 命令,该命令会创建一个 Docker 卷,以在 macOS 和 Windows 上获得更好的磁盘 I/O 性能。
- 如果你已经安装了 VS Code 和 Docker,也可以点击此处开始。这将使 VS Code 在需要时自动安装 Dev Containers 扩展,将源代码克隆到容器卷中,并启动一个开发容器供使用。
- 对于 Codespaces,请在 VS Code 中安装 GitHub Codespaces 扩展,然后使用 Codespaces: Create New Codespace 命令。
Docker / Codespace 应至少拥有4 核 CPU 和 6 GB 内存(推荐 8 GB) 才能运行完整构建。有关更多信息,请参阅开发容器 README。
法律声明
本项目与微软公司无关联。
项目介绍
Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
定制我的领域