Getting Started with Copilot
Categories:
- Copilot Labs Capabilities
- What is Copilot
- Understand
- Suggest
- Debug
- Review
- Refactor
- Document
- Using Custom to Extend Copilot Boundaries
- Getting More Professional Suggestions
- Plain Text Suggestions
- Settings
- Data Security
- FAQ
GitHub Copilot is a machine learning-based code completion tool that helps you write code faster and improve coding efficiency.
Copilot Labs Capabilities
| Capability | Description | Notes | example |
|---|---|---|---|
Explain |
Generate explanations for code snippets | Has advanced options to customize prompts for clearer needs | ![]() |
Show example code |
Generate example code for code snippets | Has advanced options to customize | ![]() |
Language Translation |
Generate translations for code snippets | This translation is based on programming languages, e.g., C++ -> Python | ![]() |
Readable |
Improve code readability | Not just simple formatting, but genuine readability improvement | ![]() |
Add Types |
Type inference | Change automatically typed variables to explicit types | ![]() |
Fix bug |
Fix bugs | Fix some common bugs | ![]() |
Debug |
Make code easier to debug | Add print logs or temporary variables for breakpoints | ![]() |
Clean |
Clean up code | Remove useless parts of code, comments/prints/deprecated code, etc. | ![]() |
List steps |
List code steps | Some code execution strictly depends on order, need to clearly comment execution order | ![]() |
Make robust |
Make code more robust | Consider boundaries/multithreading/reentrancy, etc. | ![]() |
Chunk |
Chunk code | Generally hope function effective lines <=50, nesting <=4, fan-out <=7, cyclomatic complexity <=20 | ![]() |
Document |
Generate code documentation | Generate code by writing comments, can also generate comments and documentation through code | ![]() |
Custom |
Custom operations | Tell copilot how to operate your code | ![]() |
What is Copilot
The official website introduction is simple and clear: Your AI pair programmer — Your pair programmer
Pair programming: is an agile software development method where two programmers collaborate on the same computer: one types code while the other reviews each line of code. Roles often interchange to ensure rigorous logic and problem prevention.
Copilot participates in coding work through the following ways, fulfilling the role of a pair programmer.
Understand
Copilot is a large language model, it cannot understand our code, and we cannot understand Copilot’s model. The understanding here is mutual understanding between a programmer and a group of programmers. Everyone writes code together based on some common consensus.

Copilot gathers information to understand context, information includes:
- Code being edited
- Related files
- Files opened in IDE
- Library addresses
- File paths
Copilot doesn’t just understand through one line of comments, it gathers enough context information to understand what to do next.
Suggest
| Whole paragraph suggestion | inline suggestion |
|---|---|
![]() |
![]() |
As we all know, the most common way to get suggestions is through comments describing requirements rather than directly writing code, thereby guiding GitHub Copilot to give whole paragraph suggestions. But this may cause the problem of redundant comments, comments are not always better, comments can help understand, but they are not the main body of code. Good code is clear without comments, relying on appropriate naming, reasonable design, and clear logic. When using inline suggestions, as long as you give appropriate variable names/function names/class names, Copilot can always give appropriate suggestions.
In addition to appropriate external input, Copilot also supports giving suggestions based on existing code snippets, Copilot Labs->Show example code can help generate example code for specified functions, just select the code and click Show example code.
Ctrl+Enter always gives a lot of inspiration. I created three files, one empty main.cpp file, one empty calculator.h file, and implemented “addition” and “subtraction” in calculator.cpp. Copilot gave the following suggested content:
- Add implementation of “multiplication” and “division”
- Call the implementation of “addition, subtraction, multiplication, division” in main
- Creation and usage of calculator static library
- Running results of main function, and the results are correct
- Suggested content of calculator.h header file
- g++ compilation command
- gtest test cases
- Content of CMakeLists.txt, including tests
- objdump -d main > main.s to view assembly code, and displayed the assembly code
- ar to view static library content, and displayed the static library content
Under default configuration, the content displayed each time you press Ctrl+Enter varies greatly, and you cannot review the content generated last time. If you need more stable generated content, you can set the value of temperature [0, 1]. The smaller the value, the more stable the generated content; the larger the value, the more elusive the generated content.
The above suggested content far exceeds the general suggested content for daily use, probably because the project is indeed too simple. Once the compilation files and header files are written completely, there won’t be so many suggestions, but it still often has good inspirational effects.
Using Copilot suggestions shortcuts
| Action | Shortcut | Command name |
|---|---|---|
| Accept inline suggestion | Tab |
editor.action.inlineSuggest.commit |
| Ignore suggestion | Esc |
editor.action.inlineSuggest.hide |
| Show next inline suggestion | Alt+] |
editor.action.inlineSuggest.showNext |
| Show previous inline suggestion | Alt+[ |
editor.action.inlineSuggest.showPrevious |
| Trigger inline suggestion | Alt+\ |
editor.action.inlineSuggest.trigger |
| Show more suggestions in separate panel | Ctrl+Enter |
github.copilot.generate |
Debug
Generally two debugging methods, printing and breakpoints.
- Copilot can help automatically generate print code, selecting formatted prints or logs based on context.
- Copilot can help modify existing code structure, providing convenient breakpoint locations. Some nested-style code is difficult to set breakpoints on, Copilot can directly modify them.
Copilot Labs has the following preset features:
- Debug, generate debug code, such as prints, breakpoints, and other debug code.
Review
Review is mutual, we and copilot need to frequently review each other, don’t blindly trust quickly generated code.
Copilot Labs has the following preset features:
- Fix bug, directly fix bugs it finds, need to save your own code first, carefully review Copilot’s modifications.
- Make robust, make code more robust, Copilot will find unhandled situations and generate improved code, we should be inspired by it and think more carefully.
Refactor
Copilot Labs has the following preset features:
- Readable, improve readability, genuinely improve readability, not just simple formatting, but be sure to carefully review Copilot’s modifications.
- Clean, make code more concise, remove redundant code.
- Chunk, make code easier to understand, chunk code, divide a large function into multiple small functions.
Document
Copilot Labs has the following preset features:
- Document, generate documentation, such as function comments, and other documentation.
Using Custom to Extend Copilot Boundaries
Custom is inconspicuous, but it gives Copilot infinite possibilities. We can understand it as a new programming language, this programming language is English or Chinese.
You can enter through Custom
-
remove commented code

-
add multiplication and division capabilities

-
rewrite as go

-
add trigonometric function calculation

-
add differential calculation, Chinese doesn’t work well here, usesupport calculate differential, in low temperature mode, there’s no reliable answer, in high temperature mode, there are several absurd answers.
In daily work, you can always propose your needs to Copilot, through Custom capability, you can let Copilot help complete many desired operations.
Some examples:
| prompts | Description |
|---|---|
generate the cmake file |
Generate cmake file |
generate 10 test cases for tan() |
Generate 10 test cases |
format like google style |
Format code |
consider boundary conditions |
Consider boundary conditions |
confirm memory release |
Confirm memory release |
Custom usage is full of imagination, but sometimes it’s not so reliable, it’s recommended to save your code before using it, and then carefully review the modifications it made.
Getting More Professional Suggestions
The clearer the prompts given to Copilot, the more accurate the suggestions it gives, professional prompts can get more professional suggestions. Many inappropriate codes neither affect code compilation nor business operation, but affect readability, maintainability, extensibility, reusability, these characteristics are also very important. If you want to get more professional suggestions, we’d better understand some English names of best practices.
- First is using understandable English, you can learn English by looking at open source projects.
- Naming conventions, naming is the most basic definition of concepts, good naming can avoid ambiguity, avoid readers getting bogged down in business details, thereby improving code readability, and is also a best practice.
- Usually only a reasonable variable name is needed, Copilot can give whole paragraph reliable suggestions.
- List of design patterns, design patterns are templates for solving problems, reasonably trade-off SOLID design basic principles for different problems, save solution design time, improve code quality.
- Just write out the required pattern name, Copilot can generate complete code snippets.
- List of algorithms, good algorithms are highly intelligent crystallizations for solving a class of problems, developers need to abstract specific problems themselves, and input abstracted data into algorithms.
- Algorithm code is usually universal, just write out the algorithm name, Copilot can generate algorithm code snippets, and Copilot can always cleverly apply the data structure of the context to the algorithm.
Plain Text Suggestions
| en | zh |
|---|---|
| GitHub Copilot uses the OpenAI Codex to suggest code and entire functions in real-time, right from your editor. | GitHub Copilot 使用 OpenAI Codex 在编辑器中实时提供代码和整个函数的建议。 |
| Trained on billions of lines of code, GitHub Copilot turns natural language prompts into coding suggestions across dozens of languages. | 通过数十亿行代码的训练,GitHub Copilot 将自然语言提示转换为跨语言的编码建议。 |
| Don’t fly solo. Developers all over the world use GitHub Copilot to code faster, focus on business logic over boilerplate, and do what matters most: building great software. | 不要孤军奋战。世界各地的开发人员都在使用 GitHub Copilot 来更快地编码,专注于业务逻辑而不是样板代码,并且做最重要的事情:构建出色的软件。 |
| Focus on solving bigger problems. Spend less time creating boilerplate and repetitive code patterns, and more time on what matters: building great software. Write a comment describing the logic you want and GitHub Copilot will immediately suggest code to implement the solution. | 专注于解决更大的问题。花更少的时间创建样板和重复的代码模式,更多的时间在重要的事情上:构建出色的软件。编写描述您想要的逻辑的注释,GitHub Copilot 将立即提供代码以实现该解决方案。 |
| Get AI-based suggestions, just for you. GitHub Copilot shares recommendations based on the project’s context and style conventions. Quickly cycle through lines of code, complete function suggestions, and decide which to accept, reject, or edit. | 获得基于 AI 的建议,只为您。GitHub Copilot 根据项目的上下文和风格约定共享建议。快速循环代码行,完成函数建议,并决定接受,拒绝或编辑哪个。 |
| Code confidently in unfamiliar territory. Whether you’re working in a new language or framework, or just learning to code, GitHub Copilot can help you find your way. Tackle a bug, or learn how to use a new framework without spending most of your time spelunking through the docs or searching the web. | 在不熟悉的领域自信地编码。无论您是在新的语言或框架中工作,还是刚刚开始学习编码,GitHub Copilot 都可以帮助您找到自己的方式。解决 bug,或者在不花费大部分时间在文档或搜索引擎中寻找的情况下学习如何使用新框架。 |
These translations are all generated by Copilot, it’s not certain whether these suggestions are based on model generation or translation behavior. In fact, any English content you write in the en column of the table can be translated (generated) by Copilot into the content in the zh column.

Settings
Client settings
| Setting | Description | Notes |
|---|---|---|
| temperature | Sampling temperature | 0.0 - 1.0, 0.0 generates the most common code snippets, 1.0 generates the most uncommon and random code snippets |
| length | Maximum length of generated code suggestions | Default 500 |
| inlineSuggestCount | Number of inline suggestions generated | Default 3 |
| listCount | Number of suggestions generated | Default 10 |
| top_p | Preferentially display top N probability suggestions | Default displays all possible suggestions |
Personal account settings have two settings, one is copyright-related, one is privacy-related.
- Whether to use open source code to provide suggestions, mainly to avoid copyright issues in code snippets generated by Copilot, avoiding open source license restrictions.
- Whether to allow using personal code snippets to improve the product, avoiding privacy leakage risks.
Data Security
Copilot’s information collection
- Commercial version
- Feature usage information, may contain personal information
- Collect code snippets, immediately discard after providing suggestions, does not retain any code snippets
- Data sharing, GitHub, Microsoft, OpenAI
- Personal version
- Feature usage information, may contain personal information
- Collect code snippets, after providing suggestions, according to personal telemetry settings, retain or discard
- Code snippets include, code being edited, related files, files opened in IDE, library addresses, file paths
- Data sharing, GitHub, Microsoft, OpenAI
- Code data protection, 1. Encryption. 2. Copilot team-related Github/OpenAI part of employees can view. 3. Access requires role-based access control and multi-factor authentication
- Avoid code snippets being used (retained or trained), 1. Settings 2. Contact Copilot team
- Will private code be used? No.
- Will it output personal information (name, birthday, etc.)? Rare, still improving.
- Detailed privacy statement
FAQ
- Copilot’s training data comes from Github’s public repositories.
- Is the code written by Copilot perfect? Not necessarily.
- Can it write code for new platforms? Currently limited capability.
- How to better use Copilot? Split code into small functions, describe function functionality with natural language, as well as input and output, use meaningful variable names and function names.
- Will the code generated by Copilot have bugs? Of course it’s unavoidable.
- Can the code generated by Copilot be used directly? Not necessarily, sometimes needs modification.
- Can the code generated by Copilot be used in commercial projects? Yes.
- Does the code generated by Copilot belong to Copilot’s intellectual property? No.
- Does Copilot copy code from the training set? Copilot does not copy code, extremely low probability of appearing more than 150 lines of code that can match the training set, the following two situations will occur
- When context information is very little
- Is a general problem solution
- How to avoid duplication with public code, set filter

- How to correctly use code generated by Copilot? 1. Test/review the generated code yourself; 2. Do not automatically compile or run generated code before review.
- Does Copilot have the same performance in every natural language? Best performance is in English.
- Will Copilot generate offensive content? Already filtered, but not excluded from appearing.














