Code Completion
The easiest way to use GitHub Copilot is through code completion. Code completion improves developer productivity by providing candidate code as developers type.
For example, let's say you're defining a function in JavaScript and typing the following code:
GitHub Copilot may provide candidate code that could be used inside the function. For instance, you might see code like the following:
If the developer selects this candidate code, it will be inserted into the function, resulting in:
GitHub Copilot Reference Priority
GitHub Copilot references several recently opened files in the same language, calculates their similarity, and determines which files to include in the prompt. The current logic is not publicly available, but there are resources such as a code walkthrough that provide insights into the reverse-engineered details.
Note
Because GitHub Copilot provides code generated by AI, automatically generated code may not be entirely accurate. Developers must review generated code and manually modify it as necessary. By using the code completion feature of GitHub Copilot, developers can reduce the amount of code they have to enter manually.
Last updated