HUAWEI CLOUD CodeArts Snap intelligent programming assistant PyCharm experiment manual. Plug-in installation and usage guide

As an independently innovative AI code-assisted programming tool, HUAWEI CLOUD intelligent programming assistant CodeArts Snap aims to create a new paradigm of modern development. By transforming natural language into a secure programming language that is readable and has no open source vulnerabilities, it improves the programming efficiency of developers and helps enterprises quickly respond to market demand. HUAWEI CLOUD CodeArts Snap is now in the invitation testing stage, you can download and experience it immediately!


1 Plug-in installation and download

1.1 Search plugin

Open PyCharm, select File, and click Settings.

Select Plugins, click Marketplace, and enter Huawei Cloud CodeArts Snap in the search box.

1.2 Install the plugin

As shown in the figure above, click the Install button to install the Huawei Cloud CodeArts Snap plug-in, and a pop-up pops up saying that you need to install the Huawei Cloud Toolkit Platform, click Install to continue the installation. (Note: The HUAWEI CLOUD plug-in relies on the unified HUAWEI CLOUD developer ecological base to log in, which is required)

After the plug-in is downloaded and installed, click Restart IDE, or manually close the IDE and reopen it to make the plug-in installation take effect.

After the download is complete, we can see on the IDE panel: 1) the Huawei Cloud Tookit function key on the left sidebar; 2) the Huawei Cloud CodeArts Snap plug-in icon in the lower right corner.

2 plugin login

2.1 Obtain an authorized account

If your HUAWEI CLOUD account has obtained the trial authorization of CodeArts Snap, please go directly to the next step. If not, please click  https://devcloud.cn-north-4.huaweicloud.com/codeartssnap/apply  to submit an application.

2.2 Multiple login methods

The HUAWEI CLOUD plug-in provides three login methods: 1) HUAWEI account login; 2) HUAWEI CLOUD AK/SK login; 3) third-party account login (CSDN).

2.2.1 Login with Huawei account

Method 1: Click the CodeArts Snap icon in the lower right corner, and click Login to HUAWEI.

Method 2: Click Huawei Cloud Toolkit on the left toolbar, click the character logo as shown in the figure, and select "Huawei account login".

On the browser page that pops up, fill in the Huawei ID and password.

Read and agree to the disclaimer and complete the login.

2.2.2 HUAWEI CLOUD AK/SK login

Method 1: Click the CodeArts Snap icon in the lower right corner, and click Login to HUAWEI.

Method 2: Click Huawei Cloud Toolkit on the left toolbar, click the character logo as shown in the figure, and select "Huawei account login".

Method 3: Find Huawei Cloud Toolkit Settings in File -> Settings, and click log in to quickly enter the Huawei Cloud console.

Click "Add Access Key" to apply for an access key.

Fill in any remark information and click "OK".

After the creation is successful, the system will prompt you to click Download Now, and the access key information will be saved in the credentials.csv file. Please note that each person can add up to 2 access keys, and each access key is only allowed to be downloaded once, please keep it safe. If you accidentally lose the secret key, you don’t need to worry, just delete the historical secret key and apply for creation again.

Open the downloaded access key document, copy the AK in the Access Key Id column and the SK in the Secret Access Key column to fill in the login interface and click OK.

Read and agree to the disclaimer and complete the login.

3 Plug-in Instructions

3.1 Generate trigger and function key description

3.1.1 Generate trigger instructions

Code generation (including comments) can be triggered anywhere in the IDE edit box, and there are three trigger methods.

  • hit enter
  • Shortcut key Alt + c
  • Automatically trigger after waiting for a certain period of time during programming (time and trigger mechanism can be adjusted)

3.1.2 Description of function keys

If shown, from left to right are:

  • Accept: Use the Tab key to accept the generated results
  • Next: Use Alt+] to see the next recommendation
  • More: Use Alt+R to open the right result bar to view multiple result options
  • Results: the number of generated results and the result item currently being read

3.2 Introduction to Settings

Find Huawei Cloud CodeArts Snap under File -> Settings, and click to display the list of function items.

Click Code Generation to see various personalization options.

3.3 Setting instructions

3.3.1 Code generation function switch

Here it can be regarded as the general switch of the function, Enable means to start the code generation function, and Disable means to close the code generation function.

3.3.2 Personalized function settings

The figure shows the default configuration items of personalized functions, which are interpreted sequentially from top to bottom.

3.3.2.1 Line-level Generation

Row-level code generation (enabled by default). CodeArts Snap generates code snippets based on existing code and contextual information. Row-level code generation scenarios include but are not limited to:

1) Trigger generation in a line of code: When the cursor is in a line of code to trigger code generation, CodeArts Snap will provide corresponding code continuation suggestions to quickly complete the line of code.

2) Trigger generation when there is already code in the function body: When developers write code in the function body, the plug-in will provide code continuation suggestions based on the existing code and function signature to help developers complete the writing of the function body more efficiently.

This default setting can help developers quickly implement business logic and improve programming efficiency.

3.3.2.2 Function-level Generation

Function-level code generation (enabled by default). CodeArts Snap will generate the corresponding code according to the existing function signature and text description. Function-level code generation scenarios include, but are not limited to:

1) Trigger generation when there is a function signature: the plug-in will automatically generate the matching function body code according to the function signature.

2) Trigger generation when there are function signatures and text descriptions: The plug-in will combine function signatures and text descriptions to generate more accurate function body codes to meet specific business needs.

This default setting can help developers quickly implement business logic and improve programming efficiency.

3.3.2.3 Hide Generation Tip

The function of hiding the prompt box during generation (disabled by default). As shown in the figure below, the "Generating Code..." prompt box reminds developers more clearly that the code generation function is in use.

Developers can enable the function of hiding the prompt box according to their own needs and programming habits. At this time, only the progress bar in the lower right corner indicates that the code generation function is in use.

3.3.2.4 Auto-trigger on Pause

Automatically trigger code generation (enabled by default). When the developer pauses the input during the code writing process, the plug-in will automatically recognize the context content of the cursor position, and provide generation recommendations for the next line of code or the continuation of the current line of code. This function can provide programming inspiration when developers stop thinking, improve development efficiency, and allow developers to focus more on core business logic.

3.3.2.5 Auto-trigger Time Delay

Auto-trigger code generation interval setting (the default setting is 3s). Used to control how often CodeArts Snap automatically triggers code generation after a developer pauses for input. By adjusting the time delay, you can provide developers with more appropriate thinking time, avoid too frequent prompts from interfering with the developer's programming process, and achieve better developer experience and programming efficiency. The minimum can be adjusted to 1s, and the maximum is 10s.

Guess you like

Origin blog.csdn.net/hwxiaozhi/article/details/132407252