Copilot is an AI-based programming aid. It is currently integrated in vscode and may be integrated into more platforms and tools in the future. It is still in the testing phase. Official website: copilot.github.com/
Support for all languages
Copilot is trained based on machine learning algorithms using existing public data on the web, particularly open-source code on Github. So Copilot theoretically supports all programming languages.
So far I have tested JS and Python, and the results are pretty good. Examples are provided for TS, Go, PY and RB.
Comments are code
You can write comments and then follow copilot’s prompts along the way to write the entire program.
Let’s say I want to get user information based on my Github username. All I have to do is write a comment like this. Take JS as an example:
// Obtain user information based on the Github user name
Copy the code
How does Copilot guide you through the full features step by step? Let’s see.
The first step:
Note: The code below the comment is light-colored and is prompted by Copilot. The same as below, no further explanation.
Pressing the TAB key will fill in the light-colored code and prompt the following code.
The second step:
Press TAB again and the entire code is generated.
There are many similar examples waiting to be explored.
Code completion
An important feature of an IDE is code completion. Copilot enhances IDE completion features.
Copilot can prompt you for possible inputs based on your repository and other publicly available repositories around the world, reducing your keystrokes, writing more code in less time, and getting more time out of your hands.
For example, again using JS as an example. I want to send a fetch request.
fetch('https://www.leetcode-solution.cn', {
Copy the code
And it tells me:
Following its prompts, you can write the following code just by pressing TAB.
fetch("https://leetcode-solution.cn", {
method: "POST".headers: {
"Content-Type": "application/json",},body: JSON.stringify({
question_id: "1".lang: "javascript".code: "console.log(1)",
}),
}).then((res) = > {
console.log(res);
});
Copy the code
A small part of the above code is problematic for my repository functionality. But I just need to tweak it a little bit. The efficiency gains are good.
How to use it?
Search for github copilot in the vscode plugin marketplace, click install, and follow the instructions to install it.
Once installed, you can experience it! Write notes? Code tapping? According to press the TAB? The code duang is generated immediately.
conclusion
Copilot is a tabnine-like ai programming aid that is currently available as a free vscode plug-in. It is currently in beta and has not yet been released. It has auto-hints, code from comments, and a lot of exciting features.
For more information and updates, please visit the official website: copilot.github.com/