Below is a handy cheat sheet for using GitHub Copilot in Visual Studio Code. It covers setup, common commands, best practices, and helpful tips to get the most out of Copilot’s AI-assisted coding features. Feel free to adjust it to your own workflow!


1. Setup

  1. Configure Settings (optional)

    • Go to File > Preferences > Settings (Windows/Linux) or Code > Preferences > Settings (macOS).

    • Search for “Copilot” to see configuration options (e.g., inline suggestions, enabling/disabling suggestions).


2. Basic Usage

  1. Inline Suggestions

    • Start typing your code; Copilot will suggest completions inline (semi-transparent text).

    • Press Tab to accept the suggestion or keep typing to let Copilot refine it.

  2. Multi-line Suggestions

    • Type a descriptive comment or function signature.

    • Copilot often generates multi-line code blocks following that comment.

    • Accept with Tab or Enter (depending on your settings).

  3. Ask Copilot in Comments

    • You can write a comment describing what you want, e.g., // Create a function that sums an array of numbers, and Copilot will try to generate the solution below.

  4. Trigger Suggestions Manually

    • Sometimes you need to re-trigger suggestions (especially if they didn’t appear automatically).

    • Use Ctrl + Space (Windows/Linux) or Cmd + Space (macOS) to open IntelliSense suggestions (which can include Copilot suggestions).


3. Keyboard Shortcuts & Commands

Some shortcuts may differ depending on your OS or personal keybindings. Below are the most commonly used ones out of the box.
Action Windows/Linux macOS

Accept Copilot suggestion (inline)

Tab or Enter

Tab or Enter

Show next Copilot suggestion

Alt + ]

Option + ]

Show previous Copilot suggestion

Alt + [

Option + [

Manually trigger suggestions (IntelliSense)

Ctrl + Space

Cmd + Space

Open Commands Palette

Ctrl + Shift + P

Cmd + Shift + P

Quick Commands via Command Palette

  • GitHub Copilot: Enable (turn on suggestions)

  • GitHub Copilot: Disable (turn off suggestions)

  • GitHub Copilot: Open Chat (for Chat Beta users)

Just open the Command Palette and type “Copilot” to see these commands.


4. Working with Suggestions

  1. Reviewing Multiple Suggestions

    • If you see a suggestion inline but want to check more options, use Alt + ] (Windows) / Option + ] (macOS) to cycle to the next suggestion.

    • Likewise, Alt + [ (Windows) / Option + [ (macOS) goes to the previous suggestion.

  2. Partial Acceptance

    • If only part of the suggestion is useful, you can accept it and then edit the rest.

  3. Context Matters

    • Copilot’s suggestions are heavily influenced by the surrounding code and comments. Provide meaningful function names, comments, and docstrings for better suggestions.


5. Tips & Best Practices

  1. Use Comments for Clarity

    • The more descriptive your comment, the better Copilot can guess your intentions.

    • Example:

      // Generate a React component that displays a user’s profile information
  2. Check Security & Accuracy

    • Copilot is not always perfect. Always review generated code for correctness, security issues, or licensing concerns.

  3. Experiment with Different Prompts

    • Try short prompts for quick suggestions and longer, detailed prompts for more complex tasks.

  4. Leverage Snippets

    • Combine Copilot with your existing code snippets for a hybrid approach.

  5. Disable/Enable for Sensitive Code

    • If you’re working on sensitive or proprietary code, you can temporarily disable Copilot to ensure no code suggestions are generated.


6. Common Use Cases

  1. Rapid Prototyping

    • Outline functions or data structures quickly.

  2. Boilerplate Code

    • Generate repetitive code (e.g., error-handling, common patterns).

  3. Refactoring Assistance

    • Provide a comment for how you want to refactor; Copilot may suggest partial or complete refactors.

  4. Learning New APIs

    • Use Copilot suggestions to see example usage of libraries/APIs you’re unfamiliar with.


7. Troubleshooting

  1. Suggestions Not Appearing

    • Make sure you’re logged in to GitHub, and Copilot is enabled.

    • Check your User SettingsCopilot is turned On.

    • Ensure your environment (language server, network, etc.) is working correctly.

  2. Conflicts with IntelliSense

    • Sometimes VS Code’s IntelliSense might overshadow Copilot suggestions. You can change the Copilot suggestion display setting in the extension settings (e.g., inline vs. separate panel).

  3. Rate Limits

    • GitHub Copilot has certain rate limits. If you exceed them, suggestions might be delayed or missing temporarily.


8. Resources

  • GitHub Copilot Docs: docs.github.com/copilot

  • Visual Studio Code Marketplace (GitHub Copilot extension page)

  • GitHub Copilot Community (Discussion boards, Q&A, troubleshooting)


Final Thoughts

GitHub Copilot in VS Code can supercharge your workflow by accelerating code generation and reducing boilerplate. However, always review and test the AI-generated code to ensure it meets your project’s requirements and standards.

Happy coding with Copilot!