Skip to main content
In this guide, you’ll learn how to integrate GitHub Copilot into Visual Studio Code, customize its behavior, and leverage Copilot Chat for conversational code assistance. We’ll cover:
  1. Installing the Copilot extension
  2. Trying a simple Flask example
  3. Configuring Copilot settings
  4. Exploring Copilot Chat
  5. Using contextual prompts
  6. Adding workspace-specific instructions

1. Install the GitHub Copilot Extension

  1. Launch Visual Studio Code and open the Extensions view (Ctrl+Shift+X).
  2. Search for GitHub Copilot.
  3. Click Install.
  4. Authenticate with your GitHub account when prompted.
You must have a valid Copilot subscription or trial to authenticate. Visit GitHub Copilot Pricing for more details.
The image shows the GitHub Copilot extension page in Visual Studio Code, highlighting its features and installation details. The interface includes a sidebar with other extensions and a terminal at the bottom.

2. Try a Simple Flask Example

After installation, Copilot will suggest code completions inline. Here’s a minimal Flask app with an in-memory database and a POST endpoint:
Place your cursor inside the function and start typing to see Copilot’s suggestions.
Ensure you have Flask installed:

3. Configure Copilot Settings

VS Code lets you enable or disable Copilot features globally or per language. Open Settings (Ctrl+,) and search for “Copilot.” Key options include: You can also edit settings.json directly:
The image shows a Visual Studio Code interface with the GitHub Copilot extension settings open, displaying options for enabling auto completions and configuring language-specific settings. The terminal at the bottom shows a command prompt.

4. Explore GitHub Copilot Chat

Copilot Chat provides an interactive panel for code explanations, refactoring, and test generation.
  • Click the Copilot Chat icon in the sidebar or status bar.
  • Ask questions like “Explain this function” or “Generate unit tests.”
The image shows a settings interface for GitHub Copilot, displaying various options and features related to code actions, renaming suggestions, and code generation.

Chat Configuration

Within the Copilot Chat settings, you can:
  • Enable automatic test-failure fixes
  • Suggest follow-up messages
  • Override locale (en, fr, etc.)
  • Define the default chat panel location
  • Include or exclude enterprise repositories
The image shows a settings interface for GitHub Copilot Chat, displaying various experimental features related to edits, tests, and language context.

5. Use Context with Copilot Chat

  1. Open any file (e.g., app.py).
  2. Select or add code snippets.
  3. Launch Copilot Chat and ask targeted questions:
Copilot Chat will include the current file name and selection context for more accurate responses.

6. Add Custom Instructions

To guide Copilot across your repository, create a custom instructions file:
Populate .github/copilot/instructions.md with workspace-specific guidelines:
Commit this file to version control so that all collaborators benefit from the same Copilot behavior.

You’re all set! Enjoy AI-powered completions, advanced settings, and the collaborative power of Copilot Chat to accelerate your development.

Watch Video