Code with AI assistance
In this section, you will experiment with some ways to use Duet AI for Developers in Cloud Code to get help and generate code. At the time of writing, Duet AI for Developers is in preview and is still not enabled in Cloud Shell, so we will use the Cloud Code extension on a locally installed Visual Studio Code.
At the time of writing, Duet AI for Developers must be explicitly enabled in Cloud Code. If this is still the case for you, you will need to navigate to Settings | Extensions | Cloud Code and enable it.
Getting help to understand code
Let’s ask Duet AI to explain existing code to us:
- Clone the book repository in your local environment and add the
ch3
folder to your Visual Studio Code workspace. - In Visual Studio Code, open the
HelloController.java
file insidesrc/main/java/com/example
. Select the @GetMapping method, click on the lightbulb, and select Explain this.
Figure 3.27 – Duet AI smart...