Skip to main content

关于将 Visual Studio Code 与 GitHub Classroom 配合使用

You can configure Visual Studio Code as the preferred editor for assignments in GitHub 课堂.

关于 Visual Studio Code

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. With the GitHub Classroom extension for VS Code, students can easily browse, edit, submit, collaborate, and test their Classroom Assignments. 有关 IDE 和 GitHub 课堂 的更多信息,请参阅“集成 GitHub 课堂 与 IDE”。


The GitHub Classroom integration with VS Code provides students with an extension pack which contains:

  1. GitHub 课程扩展,其中包含自定义摘要,便于学生轻松入门。
  2. Visual Studio 实时分享扩展,集成到学生视图中,以便轻松获取助教和同学的帮助与协作。
  3. GitHub 拉取请求扩展,允许学生在编辑器中查看教师的反馈。

How to launch the assignment in VS Code

When creating an assignment, VS Code can be added as the preferred editor for an assignment. 有关详细信息,请参阅“集成 GitHub 课堂 与 IDE”。

This will include an "Open in VS Code" badge in all student repositories. This badge handles installing VS Code, the Classroom extension pack, and opening to the active assignment with one click.

Note: The student must have Git installed on their computer to push code from VS Code to their repository. This is not automatically installed when clicking the Open in VS Code button. 学生可以从这里下载 Git。

如何使用 GitHub 课堂扩展包

GitHub 课堂扩展有两个主要组件:“课堂”视图和“活动的作业”视图。

When the student launches the extension for the first time, they are automatically navigated to the Explorer tab in VS Code, where they can see the "Active Assignment" view alongside the tree-view of files in the repository.

GitHub 课堂活动作业视图

学生可以通过单击 sync changes(同步更改)按钮(将鼠标悬停在“活动的作业”行上时显示)将其提交推送到最新版本的远程。 这去掉了 Git 的源代码控制,允许教师按照自己的节奏教授 Git。 如果教师已为其作业配置自动评分,同步更改还会触发“测试”运行。

如果作业是组项目,则“活动的作业”下的“组”节点将显示组的成员。 它还将显示存储库的管理员成员,当学生遇到困难时,他们可以提供帮助。 要协作处理项目,学生可以与组节点中的任何人启动实时共享会话,他们将立即与他们共享存储库的整个上下文。 您可以在此处了解有关实时共享并与之协作的更多信息。

学生完成作业后,还可以导航以查看其他作业和教室。 这些可以在 GitHub 选项卡下找到。