3. Using GitHub Copilot in VS Code
Using GitHub Copilot in VS Code
Introduction: AI Coding Assistants
AI Assistants offer increasingly powerful tools to help write and edit code. They can be used to:
- Generate code based on a prompt / description
- Fix bugs in code
- Explain code
- Refactor code
- Answer questions about code
Session Objectives
By the end of this session, you will be able to:
- Understand the capabilities of GitHub Copilot as an AI coding assistant within VS Code
- Use Copilot for inline code suggestions
- Use Copilot to generate code, explain code, fix code, and answer questions about code using the R language
Session Prerequisites
In order to use an AI coding assistant effectively and be able to supervise its output, you need to have at least intermediate-level skills in the programming language you are using. In this session, we will be using R, since it is the most widely used language among department faculty. You should be comfortable using base R, including writing functions and manipulating data (this corresponds to at least the first 24 chapters of the PDSR book).
Make sure you have completed the steps in the previous workshop to set up your GitHub account and install VS Code.
Create a GitHub Account if you don't have one:
Follow the sign-up instructions at github.com.
Join GitHub Education:
Visit GitHub Education and follow the link to join as a
teacher. (You can participate in the workshop even if you don't complete this step or your
verification is pending).
Download and install VS Code on your computer.
Download and install the latest version of R from CRAN, if not already installed on your system.
Install R packages languageserver and httpgd.
Install the R extension for VS Code either from the Extensions view (search for "reditorsupport.r") or from the VS Code Marketplace.