Setting up AWS CodeWhisperer with Visual Studio Code

AWS CodeWhisperer is Amazon’s machine learning-powered code generation tool that provides you with real-time code recommendations. CodeWhisperer will automatically generate suggestions based on your existing code and comments.

In this blog post we are going to configure AWS CodeWhisperer with Visual Studio Code.

Prerequisites

  • AWS Builder ID (You can learn how to create one here)
  • Visual Studio Code (You can download here)

Install the AWS Toolkit Extension

  1. Search for the AWS Toolkit extension in Visual Studio Code.
    VS Code Extension
  2. Click the Install button.
  3. Click the CodeWhisperer: AI powered code suggestions button.
    Select CodeWhisperer
  4. Click the Sign up or Sign in button to login with, or create, your AWS Builder ID.
    Login with AWS Builder ID
  5. Click the Copy Code and Proceed button.
    Click copy code and proceed button
  6. Paste the code to authorize your request and click the Next button.
    Click next
  7. Click Allow.
    Click allow for AWS to access your data
  8. You’ve successfully connected Visual Studio Code to the AWS CodeWhisperer service.
    Success message

Testing CodeWhisperer

  1. Open or create a new file in your language of choice. For this example we will use JavaScript.
  2. Write a comment similar to the one below:
    //write a function that multiplies two numbers and returns the result
  3. CodeWhisperer will provide you suggestions on how to write the function. You can accept the suggestion by pressing the Tab key.
    Code snippet
  4. AWS also provides code examples to help you get started. You can find them here.

Summary

In this blog post we configured and tested AWS CodeWhisperer with Visual Studio Code.

Thank you for reading!

Comments are closed.

Blog at WordPress.com.

Up ↑