{"meta":{"title":"为 GitHub Codespaces 设置默认编辑器","intro":"您可以在个人设置页面中设置 Codespaces 的默认编辑器。","product":"Codespaces","breadcrumbs":[{"href":"/zh/codespaces","title":"Codespaces"},{"href":"/zh/codespaces/setting-your-user-preferences","title":"设置用户首选项"},{"href":"/zh/codespaces/setting-your-user-preferences/setting-your-default-editor-for-github-codespaces","title":"设置默认编辑器"}],"documentType":"article"},"body":"# 为 GitHub Codespaces 设置默认编辑器\n\n您可以在个人设置页面中设置 Codespaces 的默认编辑器。\n\n在“设置”页上，可以设置编辑器首选项，以便在创建 codespace 或打开现有 codespace 时，它会在所选的以下选项中打开：\n\n* Visual Studio Code（桌面应用程序）\n* Visual Studio Code（Web 客户端应用程序）\n* JupyterLab - Project Jupyter 的 Web 接口\n\n当你从模板创建新的代码空间时，它始终会在 Visual Studio Code 网页客户端中打开。 您可以在任何受支持的编辑器中重新打开已有的 Codespace。 有关详细信息，请参阅“[打开现有 codespace](/zh/codespaces/developing-in-a-codespace/opening-an-existing-codespace)”。\n\n如果要将 Visual Studio Code 用作 GitHub Codespaces 的默认编辑器，则需要安装 Visual Studio Code 和 GitHub Codespaces 的 Visual Studio Code 扩展。 有关详细信息，请参阅 [Visual Studio Code 的下载页](https://code.visualstudio.com/download/) 和 [GitHub Codespaces marketplace 上的 Visual Studio Code 扩展](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces)。\n\n## 设置默认编辑器\n\n1. 在 GitHub 任意页面的右上角，单击你的个人资料照片，然后单击“<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-gear\" aria-label=\"gear\" role=\"img\"><path d=\"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z\"></path></svg> Settings”\\*\\*\\*\\*。1. 在边栏中的“代码、规划和自动化”下， 单击 **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-codespaces\" aria-label=\"codespaces\" role=\"img\"><path d=\"M0 11.25c0-.966.784-1.75 1.75-1.75h12.5c.966 0 1.75.784 1.75 1.75v3A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm2-9.5C2 .784 2.784 0 3.75 0h8.5C13.216 0 14 .784 14 1.75v5a1.75 1.75 0 0 1-1.75 1.75h-8.5A1.75 1.75 0 0 1 2 6.75Zm1.75-.25a.25.25 0 0 0-.25.25v5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5a.25.25 0 0 0-.25-.25Zm-2 9.5a.25.25 0 0 0-.25.25v3c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-3a.25.25 0 0 0-.25-.25Z\"></path><path d=\"M7 12.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z\"></path></svg> Codespaces**。\n2. 在“Editor preference（编辑器首选项）”下，选择所需的选项。\n\n   * 如果选择 **Visual Studio Code**（桌面应用程序），则必须确保已在本地计算机上安装VS Code。<br><br>\n\n   * 如果选择\\*\\*\\*\\*“Visual Studio Code”（Web 客户端），在下次创建或打开 codespace 时，GitHub Codespaces 将自动在桌面应用程序中打开。\n\n     你可能需要同时允许访问浏览器和 Visual Studio Code 才能成功打开。<br><br>\n\n   * 如果选择“JupyterLab”\\*\\*\\*\\*，则必须在打开的 codespace 中安装 JupyterLab 应用程序。 默认开发容器映像包括 JupyterLab，因此从默认映像创建的 codespaces 将始终安装 JupyterLab。 有关默认映像的详细信息，请参阅“[开发容器简介](/zh/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#using-the-default-dev-container-configuration)”以及 [`devcontainers/images`](https://github.com/devcontainers/images/tree/main/src/universal) 仓库。 如果未在开发容器配置中使用默认映像，则可以通过将 `ghcr.io/devcontainers/features/python` 功能添加到 `devcontainer.json` 文件来安装 JupyterLab。 应该包括选项 `\"installJupyterlab\": true`。 有关详细信息，请参阅 `devcontainers/features` 存储库中 [`python`](https://github.com/devcontainers/features/tree/main/src/python#python-python) 功能的 README 文件。\n\n## 其他阅读材料\n\n* [自定义代码空间](/zh/codespaces/customizing-your-codespace)\n* [管理代码空间](/zh/codespaces/managing-your-codespaces)"}