GitHub Copilot in VS Code
Why GitHub Copilot?
GitHub Copilot is built to work seamlessly in your IDE. It acts a bridge between you, your codebase, and LLMs like ChatGPT, Claude, etc. Copilot makes suggestions based on the context of your entire project, rather than only a single prompt.
With the web interfaces for ChatGPT, Claude, etc, you would have to upload your code in order for it to have access to the context of your project. Further, you would have to copy & paste suggestions from the browser into your IDE. If you frequently switch between working on multiple projects, or have large projects with hundreds or thousands of lines of code, this can quickly become cumbersome.
GitHub Copilot in your IDE removes friction and makes using LLMs for development tasks a breeze!
Setup
Sign up for Copilot
At this time, we cannot add more users to the NCI Enterprise premium Copilot license. However, you can still do a lot with the the free version of Copilot!
Enable Copilot:
https://github.com/settings/copilot

See more: GitHub Docs
Set up Copilot in VS Code
- Hover over the Copilot icon in the Status Bar and select ‘Use AI Features’.
![]()
- Sign in to GitHub

- Start using Copilot in VS Code!
The GitHub Copilot Chat extension should now be installed.
VS Code settings
You can customize Copilot settings in VS Code by going to Settings > Extensions > GitHub Copilot or by using the keyboard shortcut CmdCmd,, on Mac.

GitHub Copilot also works well in Positron, an IDE created by Posit based on VS Code.
Demo: a simple python script
Example project: given a GTF file, extract the gene transcription start sites and create a BED file of promoter regions.
Files:
- extract_promoters.py - Example Python script for demonstrating Copilot
- setup.sh - Download data files for testing the Python script
Create a new directory called extract-promoters, download these files, and place them in that directory.
Open project in new window
Open the directory for your project with VS Code.

We recommend initializing git and making a commit with the existing code before you start using Copilot.
pwd
# /path/to/extract-promoters/
git init
git add extract_promoters.py setup.sh
git commit -m 'Initial commit'Automatic inline suggestions
Copilot will make suggestions automatically as you type. You can adjust this behavior in settings.

<vscode://settings/editor.inlineSuggest.enabled>
Example: automatic docstring suggestion
Place your cursor where a function docstring should be, wait a little bit, and see if Copilot suggests one. If needed, start typing """ and see if that triggers Copilot to suggest a docstring.
{fig-alt=VS Code editor window showing GitHub Copilot automatically suggesting code as light gray text inline with the user’s typing.}
You can press TabTab to accept the suggestion, or EscEsc to reject it.
Inline chat
Press Cmd-ICmd-I to open the inline chat and ask for modifications right where your cursor is.


You can click the checkmark to accept the suggested edit if it meets your expectations. You can always modify it after accepting it if there are minor corrections to make.
Source Control: git GUI in VS Code
Copilot can even suggest commit messages for you! Using the Source Control extension, add your script to the git staging area and ask Copilot to suggest a commit message.

Click the sparkles ✨ icon on the right side of the commit message box to generate a commit message using Copilot.

Read the commit message and make sure it accurately describes the changes you’ve made before you accept it.
Tips
- Always read and understand the AI suggestion before accepting it
- Use git and commit your changes often
- Write tests to make sure your code works the way you think it does
- Periodically step back and reflect on what you’re trying to accomplish










