Visual Studio Code
Preparations
- Visit the Huawei Cloud official website and register a Huawei Cloud account by referring to Signing Up for a Huawei Cloud Account.
- Download and install Visual Studio Code 1.95.3 (November 13, 2024) or later.
- Operating system: Windows 10 (x64, 2019 or later) or Windows 11 (x64)
Step 1: Install and Log In to the Plug-in
- Start Visual Studio Code and click the extensions icon
in the sidebar. - In the search box, enter CodeArts Agent and press Enter.
- In the search result, find the plug-in and click Install.
If the
icon is displayed in the Visual Studio Code sidebar, the plug-in is successfully installed. - Click the
icon in the sidebar to bring up the chat window. - Click HUAWEI ID Login. Your browser will launch automatically. Enter your HUAWEI ID and password to log in.
If you are using CodeArts Agent for the first time, the system will automatically activate the free package upon your successful login. If you want to unlock more advanced features, you can upgrade your package at any time from the Subscriptions page.
- Create a project to store files in the project.
Step 2: Try CodeArts Agent
The following three examples will give you a hands-on feel for the powerful capabilities of Huawei Cloud CodeArts Agent.
Developing a Web Page with the Agent
You only need to describe your requirements (for example, developing a clean frontend login page). The agent can automatically plan the logic, write code, and generate a directly executable program.
- Click
to open the chat window, switch to the mode, and then switch to the Vibe Coding mode. - Enable AI-based automation.
- Click
in the upper right corner to access the settings page. - Choose Dialog Flow > Agent > Auto-approve, and click
to enable the items required for automatic approval, including editing, browser access, and the web page content capture tool.
- Click
- Send your requirements to AI.
Develop a clean frontend login page.
- After the page is created, find the generated login.html file in the Explorer on the left, right-click the file, and choose Reveal in File Explorer. Double-click and open the login.html file to view the login page.
Generating Code and Inquiring R&D Knowledge
- Click the icon
in the sidebar to open the chat window and switch to the mode. - Send your requirements to AI.
Analyze what a binary tree is and write a Python code example.
- The chat window returns the binary tree explanation and a Python code example. Click the Insert icon
in the upper-right corner of the code block to add the code directly to a new file. Figure 1 Generation effect
- You can ask follow-up questions based on the AI's response to continue the multi-turn conversation. For example, you can continue to send requirements to the AI.
Rewrite the generated Python code in Java.
Figure 2 Generated Java code
Completing Code
You can use AI to autocomplete Java code for computing the nth Fib4 number using context or inline comments.
- Create a Java class file (for example, Solution.java). Enter the following code in the code editor:
public class Solution { /** The Fib4 number sequence is a sequence similar to the Fibonacci sequence that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fib4(2) -> 2 fib4(3) -> 0 fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. >>> fib4(5) 4 >>> fib4(6) 8 >>> fib4(7) 14 */ public int fib4(int n) { } } - Press Alt+C after public int fib4(int n) {. The AI will generate the corresponding code in the editor based on your comment. To obtain more accurate and complete multi-line code generation, you are advised to enrich the code comments.Figure 3 Code completion effect
- If you accept the current code suggestion, press Tab or click Accept in the editing area to apply it. Figure 4 Accepting the code completion suggestion
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot