Using GitHub Copilot in VS Code
GitHub Copilot is an AI pair-programmer that lives inside Visual Studio Code. Once enabled, it offers real-time suggestions, whole-function completions, inline explanations, and conversational chat support—all without leaving your editor. This guide combines setup, shortcuts, and day-to-day techniques to help you get productive fast.
🚀 Quick setup checklist
Section titled “🚀 Quick setup checklist”- Install the extensions: Open the Extensions view (
Ctrl+Shift+X), search for GitHub Copilot, and install it. Install GitHub Copilot Chat to unlock the chat panel. - Sign in to GitHub: When prompted, click Sign in to GitHub, authorize in your browser, and return to VS Code.
- Enable in your languages: Start typing in a supported file (JavaScript, TypeScript, Python, C#, Java, Go, and more). Copilot activates automatically.
- (Optional) Configure policies: In enterprise environments, review organization policies or seat management from the GitHub admin settings.
🔑 Key experiences inside VS Code
Section titled “🔑 Key experiences inside VS Code”Context-aware code suggestions
Section titled “Context-aware code suggestions”- Copilot analyzes the file, surrounding project, and recent edits to predict the next line, block, or entire function.
- Inline “ghost text” updates in real time as you type. Accept (
Tab), skip (Esc), or cycle (Alt+[,Alt+]).
Copilot Chat panel
Section titled “Copilot Chat panel”- Use the chat view (
Ctrl+I) for natural-language questions about your workspace, frameworks, or debugging steps. - Ask for refactors, explanations, or tests; Copilot inserts runnable code snippets with one click.
Inline chat & code actions
Section titled “Inline chat & code actions”- Trigger inline chat with
Ctrl+Enterto request edits at the cursor without leaving the editor. - Apply Copilot-generated code actions to insert, replace, or scaffold files while preserving your undo history.
Documentation and explanations
Section titled “Documentation and explanations”- Highlight code and ask Copilot to explain it, generate docstrings, or add inline comments. Great for knowledge transfer and onboarding.
⌨️ Essential keyboard shortcuts
Section titled “⌨️ Essential keyboard shortcuts”| Action | Windows / Linux | macOS |
|---|---|---|
| Accept suggestion | Tab | Tab |
| Reject suggestion | Esc | Esc |
| Next suggestion | Alt+[ | Option+[ |
| Previous suggestion | Alt+] | Option+] |
| Trigger inline chat | Ctrl+Enter | Cmd+Enter |
| Open Copilot Chat | Ctrl+I | Cmd+I |
| Open Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
💡 Everyday workflows
Section titled “💡 Everyday workflows”- Prompt with comments: Describe the intent or constraints above a function. Copilot tailors suggestions to match.
- Iterate quickly: Use
Alt+[/Alt+]to cycle variations before accepting the best option. - Refactor in chat: Select a block, open inline chat, and ask for a refactor or test case generation.
- Explain legacy code: Highlight unfamiliar logic and request an explanation to speed up onboarding.
✅ Best practices
Section titled “✅ Best practices”- Review every suggestion: Treat Copilot like an assistant. Ensure generated code meets quality, security, and licensing requirements.
- Keep prompts specific: Explicit instructions in comments or chat yield more accurate completions.
- Mix with other extensions: Use linters, formatters, and test runners to validate Copilot’s output automatically.
- Use partial accept: Accept a suggestion, then edit or trim it to fit your codebase’s conventions.
🛠️ Troubleshooting & tips
Section titled “🛠️ Troubleshooting & tips”- No suggestions? Check that Copilot is enabled (
Settings > Extensions > GitHub Copilot), confirm you’re signed in, and verify the file type is supported. - Slow responses: Large files or limited connectivity can delay results. Try restarting VS Code or disabling conflicting extensions.
- Policy restrictions: Organization administrators can disable certain features. Verify access in GitHub’s settings if chat or inline actions are missing.
- Share feedback: Use the Give Feedback button in suggestions or the chat panel to improve future responses.
💵 Pricing snapshot
Section titled “💵 Pricing snapshot”- Free: Students, teachers, and verified open-source maintainers.
- Individual: $10/month or $100/year per user.
- Business: $19/user/month with enterprise-grade security, seat management, and policy controls.
Next steps
Section titled “Next steps”Explore related guides such as GitHub Copilot CLI or Copilot for Visual Studio 2022 to extend Copilot across your toolchain.
🚀 Start coding with Copilot in VS Code today and experience AI-assisted development that keeps you in flow.