VS Code generates 80% of the code in one second? Goose factory people's true feelings

a2a7420c8b129fcd0efc5bedbc9c3590.gif# Follow and star Tencent Cloud developers

# Weekly 4 | Goose factory front-line programmers, "test poison" new technologies for you

# Issue 3 | Tencent Mengjian: Evaluation of the new feature experience of VSCode Copilot Chat

d63e0446c9ee733799d6d67ad086ecd8.png

GitHub Copilot has only been released for two years, and has helped more than one million developers create more than 46% of the code volume, and has increased the coding speed by up to 55%.

Recently, VScode released version 1.80. This heavy update directly introduces a new feature of GitHub Copilot - Copilot ChatAI chat assistant is coming!

Is it chicken ribs or productivity?

Before the answer is revealed, if you want to experience the latest version and download the VSCode plugin, you can visit: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat

After installation, you will find that there is an additional chat entry in the sidebar, which can be used after linking to the Github account (the account needs to be passed through the waitlist):

1de5872802bef8cad530c063a51502b5.jpeg

282b7e7ff86317f3307616b713811f84.gif

2eb43e5c7a2025d31eb27effa6752b6b.png

Copilot Chat mainly provides an interactive interface.

As we can see in the help documentation, it supports the following capabilities:

▶︎ Explain what a single line of code, an entire file, or a library API does.

▶︎ Find problems and even fix them.

▶︎ Rewrite code to make it more readable or faster.

▶︎ Write new tests and components.

▶︎ Ask questions about VS Code.

▶︎ Ask general programming questions.

▶︎ ……

And of course commands starting with / :

▶︎ /tests - generate unit tests for selected code

▶︎ /fix - Suggest fixes for selected code issues

▶︎ /explain - explains how the selected code works

▶︎ /ext - Questions about VS Code extension development

▶︎ /vscode - Questions about VS Code

▶︎ /help - General help about GitHub Copilot

▶︎ /createWorkspace - Create a project

29fc4d65b7d05a8296acbbf307879106.png

4f8737962f4c0851d3a2b166dd333e09.jpeg


Just like GPT, we can directly ask questions about parts of the code that we do not understand. After selecting the text, enter the /explain command and add the content we want to ask. (Here, English is returned by default. If you ask questions in Chinese, you can also get Chinese answers).

Here we chose a very complex regularization for testing. We can see that the model understanding is still very good, and it can be explained very carefully. We can also ask questions about the scene and let AI act as your teacher.

8ff5e3e6ece5034a49f99516e7e25604.png

23a150d59cf9446012db7468cd6c641a.jpeg


In this test, I deliberately changed a variable by mistake (but the syntax is guaranteed to be normal, just a logical error), Copilot can directly find the problem of this change, and give the corrected code. Please look at the picture.

For such independent small functions, Copilot's error correction ability is still good.

003efbe2709ce42b46f858f0d5ddb2ee.png

55f42dcba6d87ebf2a4f8809e3d61b18.jpeg

You can ask Copilot to help generate test cases for the function, and then run to verify the accuracy of the test cases.

In this case, Copilot helped generate a total of 6 use cases, 5 of which passed and 1 failed. After a closer look, there are some problems with the expected output of this use case. It can be seen that there are still some problems with the accuracy of the use cases generated by the model.

However, from the perspective of completeness, the test cases generated by Copilot still give us a lot of inspiration, which is a great reference and efficiency improvement in writing test cases.

Of course, we can also use Copilot to complete code refactoring, write a new component and other tasks. I believe that you can use Copilot to try out the exploration scenarios that you may also use in your daily life, so we won't repeat them here.

78c887517e97d48f8c34f50b3a82559e.png

Version 1.8 introduces an interesting little feature that supports the /createWorkspace command, which can help us quickly create a new project:

61e2a96ccd656c5319babaf4aa6cf961.jpeg


But when I actually ran it, I found that there were still many problems:

5ff92b970a53d0aa535547c9759cc8ed.jpeg


It can be seen that the vue-cli-service used by the project generated by Copilot is outdated, and some babel and webpack configurations are missing. This part should still be limited by the current AI training corpus time. Generally speaking, it is easy to get out of track with the latest current data. This function may require networking capabilities to be better used.

205f3f472740ca9fab71af840ce9b0d3.png

It is worth noting that this plugin still has a lot of room for improvement. Such as the boundary of the model - fantasy problem.

e45edf30a589e6e4c8fc7f8ed20a61fa.jpeg


It can be seen that when some difficult questions are asked, Copilot will imagine some non-existent APIs to try to answer. This kind of situation will also happen in GPT, which is also a limitation of the current large model, and some fabrications and fantasies that are not based on facts will be made. In the process of using AI, we need to carefully discern its correctness.

Although there are limitations, in general I think Copilot Chat is still a very useful tool. We have been able to see ta assisting us in many scenarios, such as the two scenarios I personally use:

▶︎ Code understanding : AI is often sought to help understand complex code logic, especially when reading source code.

▶︎ Code completion : It is very helpful to improve efficiency when writing code. You can also perform pair programming with Copilot when writing code to improve your code quality.

I believe that with the continuous update and improvement of the model, Copilot Chat will become more and more useful, and I look forward to embracing the new era of programming in the future.

If you can complete the development by "moving your mouth", what kind of project do you want to do most? Welcome to leave a message. We will select one of the most creative answers, and send Tencent customized programmer cultural shirts to those who leave a message. The draw will be held at 12:00 noon on August 14th.

5fe9888112bbe41c88472f739a19d622.png

6bc66c7f9dfd6ce4b7b3eb5184814cb1.png

40d7fdb34daf456b6d5f0f5f82641d76.png

02f029b5411e0991294f25e618173153.png

8cee295d6f8e52cd8033e339149b3101.png

64533e3cd25e5a166685e8975e1955f9.png

Follow and star Tencent Cloud Developers

Watch Goose Factory Programmers evaluate new technologies every 4 weeks

Guess you like

Origin blog.csdn.net/QcloudCommunity/article/details/132222388