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.