Getting Started with GitHub Copilot in Visual Studio Code

đź”– Prerequisites
- Visual Studio Code installed (version ≥1.70)
- GitHub account (free tier works; subscription required after trial)
- Basic familiarity with the VS Code interface (panels, Command Palette)
1. Install the GitHub Copilot Extension in VS Code
- Open VS Code.
- Click the Extensions icon (or press
Ctrl+Shift+X
). - Search for "GitHub Copilot" and select the official extension by GitHub.
- Click Install, then Reload when prompted.

2. Authenticate Copilot with Your GitHub Account
- In VS Code, open the Command Palette (
Ctrl+Shift+P
). - Type and select "GitHub Copilot: Sign In".
- A browser window will open—log in with your GitHub credentials.
- Authorize the Copilot extension to access your account.
- Return to VS Code; you should see Copilot: Connected in the status bar.
✏️ Note: A GitHub Copilot subscription is required beyond the free trial.
3. Trigger Your First Copilot Suggestions in VS Code
- Open (or create) a code file—e.g.,
index.js
for JavaScript ormain.py
for Python. - Copilot will display a ghosted suggestion inline. Press Tab to accept it.
- Review the generated code and customize as needed.
Start typing a function signature or comment. For example:
// Function to fetch user data from an API and log the names
async function fetchAndLogUsers() {
}
✏️ Noob tip: Use comments (//
or#
) to guide Copilot on what you want it to build.
4. Explore Inline Suggestions & Copilot Chat
- Inline Suggestions: Continue typing, and Copilot offers completions.
- Open Copilot Chat: Press
Ctrl+Shift+P
and select "Copilot: Chat" to ask Copilot questions in natural language.
🚀 Pro tip: Use the chat to get explanations or scaffold larger code blocks.
5. Customize Copilot Settings
- Open VS Code Settings (
Ctrl+,
). - Search for "Copilot".
- Adjust options such as:
- Enable/Disable inline suggestions
- Suggestion frequency
- Exclude languages where you don’t want Copilot
🛠️ Tip: You can enable Copilot per workspace or globally.
6. Best Practices
- Review suggestions carefully—Copilot can propose insecure or inefficient code.
- Use comments to get more accurate, context-specific suggestions.
- Combine Copilot with tests: scaffold tests first, then let Copilot implement functions.
Frequently Asked Questions
Q1: Do I need a paid Copilot subscription?
A: You get a 60-day free trial. After that, a paid plan is required to continue using Copilot.
Q2: Which file types does Copilot support in VS Code?
A: Copilot works with most common languages (JavaScript, Python, TypeScript, Go, etc.). Use comments to guide suggestions in less common file types.
Q3: Can I disable Copilot in specific projects?
A: Yes—open the workspace settings and uncheck Copilot: Enable.
Links
- Official Docs: GitHub Copilot documentation