Skip to content

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.

  1. 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.
  2. Sign in to GitHub: When prompted, click Sign in to GitHub, authorize in your browser, and return to VS Code.
  3. Enable in your languages: Start typing in a supported file (JavaScript, TypeScript, Python, C#, Java, Go, and more). Copilot activates automatically.
  4. (Optional) Configure policies: In enterprise environments, review organization policies or seat management from the GitHub admin settings.
  • 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+]).
  • 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.
  • Trigger inline chat with Ctrl+Enter to 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.
  • Highlight code and ask Copilot to explain it, generate docstrings, or add inline comments. Great for knowledge transfer and onboarding.
ActionWindows / LinuxmacOS
Accept suggestionTabTab
Reject suggestionEscEsc
Next suggestionAlt+[Option+[
Previous suggestionAlt+]Option+]
Trigger inline chatCtrl+EnterCmd+Enter
Open Copilot ChatCtrl+ICmd+I
Open Command PaletteCtrl+Shift+PCmd+Shift+P
  • 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.
  • 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.
  • 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.
  • 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.

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.