Hello, I’m PI Tang. Recently, there is an interesting tool Github Copilot being discussed in the group. It is said that it can free workers to write code automatically! I felt very curious at that time, so research, share to everyone π!
I believe that all workers will encounter a lot of problems when writing code, these problems may be they never understand, maybe they know a little but not familiar with, maybe they know before but forgot.
Encounter the above problem, compared to most people’s first idea is: Google and Baidu!
For example, I want to search for how to use the API provided by Twitter to get some interesting tweets to develop my application.
Further down the line, the second thought might be: look up the documentation.
For example, learn how to write a simple component from Svelte’s documentation.
But some documents are often wordy and do not provide search, making it difficult to simply find the use of an API; A better document may provide a more convenient search function, which can reduce the time to solve the problem somewhat.
Vue documents, for example, provide easy searching.
We use this method all the time, but the problem is that it requires a lot of switching back and forth. The average person might need to focus on writing code, and switching between a search engine page, a document page, and a code editor would break the train of thought.
The above scenario is familiar, right? π is not originally not big desktop, return window all over the sky.
Github, the world’s largest gay dating site, has launched Github Copilot! A new AI code assistant, when writing code in the editor or writing comments to describe code, automatically generates for you the next need to write code, so that you do not need to search for various documents, all operations are done in the editor!
Let’s start with an intuitive example of how powerful Github Pilot can be.
A comment is written in the above code, describing that we need to write a judgment function, use the Web service to get a piece of text, determine whether the sentiment of the text is positive or negative, and then introduce the fetch function to fetch the content of this article, write the function name and give the type of input and return value. Then all of a sudden Github Copilot generates code that might be written next! Opponents!
It can be seen that the generated code is not random and illogical. It uses fetch to grab the corresponding link, and then uses await to process the asynchronous request. After getting the result, it can judge whether the emotion of the text is positive by the content in the result. Do not need their own blind search π§, efficient!
If the above code needs to be written directly by an engineer, he may first know the usage of fetch, then copy the usage and use it, and then go to Baidu and Google to find out which API service can be used, and then know the return length of this API service before writing the above code.
Boy, CV engineers will be laid off and product managers will write code.
In addition to automatically generating code from comments above, Github Copilot has a number of interesting features that we’ll take a look at.
features
Remove complexity π
When you write repetitive code, Github Copilot automatically fills in the code you might want to write next:
Have a little test ποΈβοΈ
Writing unit tests can be tedious and tedious, but Github Pilot gives you a different experience. Just import your unit test package and Github Pilot will generate the corresponding test code for your code:
Draw a picture π?
As long as you import the corresponding package and give it a reasonable name, Github Copilot can write whatever code you might want to write next, such as importing D3 and writing a drawScatterplot variable to generate code like this:
JS, Python, and more? π
Thanks to Github being the world’s largest code library, containing the most comprehensive and fresh variety of code, Github Copilot supports generation in a variety of languages, such as JS, Python, Ruby, TypeScript, Go, and more.
Become a Tab engineer? πΌ
We know that making Copilot may fill in according to the comments, automatic code generation duplicate code, code generation for you test, basic solved when you’re writing code might need a variety of questions need to open multiple Windows, these features to reduce the newcomer to learn programming, and a library, the threshold of the want to learn a new language and library.
But sometimes Github Copilot doesn’t generate the code you want for the first time, and in those cases it also gives you an option. You can select the next one using Option +] (Alt on Windows), option+[Select the previous one, Tab to receive Github Pilot’s code recommendations for you.
So, CV engineer transferred to Tab engineer π΄?
From now on the keyboard is only Tabπ.
Can I use π΄?
The answer is yes, but not right away.
Because the Github Pilot is powered by very expensive hardware, it is currently only available to a small number of people to understand how users use it and explore how to scale to commercial use.
However, according to my experience and the experience of my colleagues, basically, as long as the application can be approved, but there is still a period of time from application to approval, about 1-2 days.
How to apply?
Visit copilot.github.com/ and click to register:
Then connect to your Github account, apply, and receive this message:
The above prompt has been added to the waiting list, waiting for the official email notification can be used.
Github Copilot only supports VSCode, JetBrains editor, and Neovim. More editors will be supported in the future, so if you want to experience the function, Then you need to download the corresponding editor. We VSCode, for example, to open the editor in extension search making Copilot, or visit marketplace.visualstudio.com/items?itemN… Download link:
After installation, when you create a new file or open a file edit, Github Copilot will prompt you to request Github login authorization in the lower right corner of the editor:
All you need to do is click on the login button, and then log in to the Github authorization site using the Github account you just signed up for with the Github Copilot.
All right, you’re done! Next you can start writing code in a language you’re familiar with, and enjoy Github Copilot’s fantastic coding tips! Secretly tell you, my colleague used good π€ͺ.
The principle behind it
I believe many partners will be curious to see here. How is Github Copilot so smart?
Github Copilot is based on the CodeX AI model provided by OpenAI. It uses a lot of open source code and is trained in natural language on the Internet, making it smarter than other code assistants and able to understand the context of code and natural language (such as comments) from the files you are currently editing. Then according to the knowledge learned in the training, it gives the most reasonable several answers (code).
Github Copilot gives the code hint roughly as follows:
A simple analysis is:
- Firstly, CodeX, the model of OpenAI, was used to extract public network code and Internet text as corpus for training
- Then use Github Copilot as the service delivery layer
- The user then downloads the plug-in to the editor, activates the Github Copilot service when writing code, sends the code context to the Github Copilot service, and gets code suggestions
- Users can select the code options they want, or make changes to the generated code to suit their needs, and these selections and changes are sent to the Github Copilot service to help make the AI model smarter
You need to pay attention to π’
Github Copilot, while powerful, has some issues to be aware of when using ππ»βοΈ.
Will Github Copilot replace programmers?
No, Github Copilot’s main purpose is to assist programmers in coding, eliminating some redundant manual labor and focusing on solving interesting problems to make programmers more productive.
Does the Github Copilot generate code with intellectual property rights?
No, you can use Github Copilot as a compiler or something more low-level that gives you suggestions to help you write better code, with the final code being your own.
Can I use the code generated by Github Copilot in a production environment?
Yes, but it is recommended that you treat the code as if it were written, test it rigorously, and code review it, because the corpus used to train the AI model can be outdated and problematic, although Github Copilot iterates over it and sets rules to ensure that problematic and outdated code is not generated. But there is no guarantee that these rules will cover all cases.
Github Copilot gets my private data? Invasion of my privacy?
No, Github Copilot currently only analyzes the context in which you edit files. It also sets strict filtering rules for private information, such as replacing private email data with a common email format, [email protected]. It doesn’t analyze other data on your computer, and when recommending generated code, The code is also strictly filtered.
The uploaded content will only be saved to Github Copilot’s database and will not be made available to others.
That’s all about Github Copilot. What do you think of this product? Welcome to the comments section ππ»
/ Thank you for support /
That is all the content of this sharing. I hope it will help you
Don’t forget to share, like and bookmark your favorite things
Welcome to the public number programmer bus, from byte, shrimp, zhaoyin three brothers, share programming experience, technical dry goods and career planning, help you to avoid detours into the factory.