Full access is free during Beta. A paid subscription will be offered after Beta.

GitHub Copilot — User Guide

Industry-standard AI pair programmer for code completion and generation.

Visit website
Paid
Strengths
  • Deeply integrated with mainstream IDEs such as VS Code and JetBrains, no need to switch tools
  • Real-time code completion, understand the context, complete the entire function instead of a single line
  • Copilot Chat can chat directly in the editor, explain the code and generate tests
  • Supports GitHub repository-level contextual understanding
  • The enterprise version supports private code base training to protect code privacy
Best for
  • Daily coding acceleration: automatic completion of functions, classes, and comments
  • Quickly generate sample code (CRUD, API interface, test cases)
  • Code interpretation: understanding other people’s code or legacy code
  • Unit test generation: automatically generate test cases for functions
  • Code Refactoring: Refactor and explain changes directly within the IDE

Basic usage in VS Code

The most powerful thing about Copilot is its seamless integration within the IDE. Here is the core usage.

Scenario

Annotation-driven code generation

Prompt example
In VS Code, write a comment:

# Function: parse the date string entered by the user
# Supported formats: YYYY-MM-DD, DD/MM/YYYY, MM-DD-YYYY
# Return: datetime object, return None if parsing fails
# Contains error handling and logging
def parse_date(date_str: str):
Output / what to expect

Copilot will automatically complete the complete function:

  • Use dateutil.parser or manually parse multiple formats
  • Contains try/except error handling
  • Add logging logging
  • Return type annotation is correct

Press Tab to accept a suggestion, Alt+] to view the next suggestion.

Tips

The more detailed the comments, the more accurate the generated code will be. Annotations in Chinese are also perfectly fine.

Scenario

Explain complex code using Copilot Chat

Prompt example
Select a piece of complex code and enter it in Copilot Chat:

/explain

Or:
What does this code do? Are there any potential performance issues?
Output / what to expect

Copilot Chat will:

  1. Explain the code logic in natural language (line by line or as a whole)
  2. Point out potential problems (such as: O(n²) complexity, memory leak risk)
  3. Suggest optimization solutions
Tips

You can also quickly explain it by right-clicking on the code → "Copilot" → "Explain This".

Starter & above

The rest of this guide

Additional scenarios and the full comparison table are included with Starter and above. Sign in with an eligible account to load them.

You're on the Free plan. Upgrade to Starter or higher to unlock the rest of this guide—additional scenarios and the full comparison table.

Loading full guide…