AI automatic code writing plugin Copilot (co-pilot)

AI automatic code writing plugin Copilot

提示:Copilot单词直译过来就是副驾驶员的意思。

Introduction: In essence, it is based on GitHub open source code of 100 million levels, training AI models, and automatically generating code.

It is the amount of data (GitHub has a huge amount of data!) that can determine the accuracy of your AI model.


Install

Copilot official website: https://copilot.github.com/

You need to apply for your own GitHub account.

Support VS Code and JetBains family bucket, go to settings to download the corresponding plug-ins.

The plugin name is called GitHub Copilot.


Features

  1. Autocomplete code.
  2. Automatically generate code based on comments.
  3. Automatic inference, generating similar code.
  4. Automatically generate tests.
  5. Code suggestions are automatically generated, providing options.

When Copilot generates code, it will retrieve the contextual code to help you automatically generate some relevant test data and so on.


Comments enter the singleton pattern. enter = "tab and then generate code, the following is a double retrieval mode.

Singleton mode lazy double search:
insert image description here

But entering other design patterns will only generate some relevant code, not the code that you really want to use.


Some common logic can still be accurately declared , such as username verification, province certificate verification, password verification, etc. And it will involve some logic of the context code. It feels okay to use this to fight.
insert image description here


If you are a Java programmer, using Copilot to write code can indeed save a lot of time.

Like in the normal MVC pattern, code can be quickly generated based on comments, and it can help us automatically complete other logic based on some logic.

Of course, not only MVC mode, like SSM, SpringBoot project code can also generate completion, which is still very good.

However, if you are in a company, it is best to use it with caution . Most companies disable code generators, and the code generated by GitHub AI is inaccurate in many cases. However, it is still very useful to study and write some of your own projects.

insert image description here


It is good to use it as a tool class, such as date conversion, object conversion, etc. The generated code is still very accurate.
insert image description here


To sum up, usually study, write and write projects, can be used, save time. However, use it with caution at work!

Guess you like

Origin blog.csdn.net/IT_Holmes/article/details/126053547