

# Generating inline suggestions with Amazon Q Developer
<a name="inline-suggestions"></a>

Amazon Q can provide you with code recommendations in real time. As you write code, Amazon Q automatically generates suggestions based on your existing code and comments. Your personalized recommendations can vary in size and scope, ranging from a single line comment to fully formed functions.

When you start typing out single lines of code or comments, Amazon Q makes suggestions based on your current and previous inputs. Filenames are also taken into consideration.

Inline suggestions are automatically enabled when you download the Amazon Q extension. To get started, start writing code, and Amazon Q will begin generating code suggestions.

You can also customize the suggestions Amazon Q generates to your software development team's internal libraries, proprietary algorithmic techniques, and enterprise code style.

**Topics**
+ [Pausing suggestions with Amazon Q](#toggling-suggestions)
+ [Amazon Q code completion in action](#what-is-walkthrough)
+ [Generating inline suggestions in AWS coding environments](setting-up-AWS-coding-env.md)
+ [Using shortcut keys](actions-and-shortcuts.md)
+ [Using code references](code-reference.md)
+ [Code examples](inline-suggestions-code-examples.md)

## Pausing suggestions with Amazon Q
<a name="toggling-suggestions"></a>

Choose your IDE to see steps for pausing and resuming inline code suggestions in Amazon Q.

------
#### [ Visual Studio Code ]

1. In VS Code, choose **Amazon Q** from the component tray at the bottom of the IDE window.

   The Amazon Q task bar opens at the top of the IDE window. 

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

The following image shows the Amazon Q task bar in VS Code.

![\[The Amazon Q task bar in VS Code.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/VSC-taskbar.png)


------
#### [ JetBrains ]

1. In your JetBrains IDE, choose **Amazon Q** from the status bar at the bottom of the IDE window.

   The Amazon Q task bar opens above the status bar. 

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

The following image shows the Amazon Q task bar in a JetBrains IDE.

![\[The Amazon Q task bar in a JetBrains IDE.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/JB-taskbar.png)


------
#### [ Eclipse ]

1. In your Eclipse IDE, choose the **Amazon Q** icon in the top right corner of the IDE. 

1. With the Amazon Q chat tab open, choose the ellipsis icon in the top right corner of the tab. The Amazon Q task bar opens.

   The following image shows the Amazon Q task bar in an Eclipse IDE.  
![\[The Amazon Q task bar in an Eclipse IDE.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/eclipse-taskbar.png)

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

------
#### [ Visual Studio ]

1. From the edge of the window, choose the Amazon Q icon.

1. Select **Pause Auto-Suggesions** or **Resume Auto-Suggestions**

The following image shows the Amazon Q task bar in a Visual Studio.

![\[The Developer Tools menu in Visual Studio.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/vstudio-toggle-suggestions.png)


------
#### [ AWS Cloud9 ]

Amazon Q does not support toggling suggestions on and off in AWS Cloud9.

To stop receiving Amazon Q suggestions in AWS Cloud9, remove the IAM policy that gives Amazon Q access to AWS Cloud9 from the role or user that you are using to access AWS Cloud9. 

------
#### [ AWS Lambda ]

To deactivate or re-activate Amazon Q code suggestions in Lambda:

1. In the Lambda console, open the screen for a particular Lambda function.

1. In the **Code source** section, from the toolbar, choose **Tools**.

1. From the dropdown menu, choose **Amazon Q Code Suggestions.**

------
#### [ Amazon SageMaker AI Studio ]

1. In the SageMaker AI Studio console, choose Amazon Q from the bottom of the window.

   The Amazon Q panel will open.

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

------
#### [ JupyterLab ]

1. In the JupyterLab console, choose Amazon Q from the bottom of the window.

   The Amazon Q panel will open.

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

------
#### [ AWS Glue Studio Notebook ]

1. In the AWS Glue Studio Notebook console, choose Amazon Q from the bottom of the window.

   The Amazon Q panel will open.

1. Choose **Pause Auto-Suggestions** or **Resume Auto-Suggestions**.

------

## Amazon Q code completion in action
<a name="what-is-walkthrough"></a>

This section demonstrates how Amazon Q can help you write a complete application. This application creates an Amazon S3 bucket and a Amazon DynamoDB table, plus a unit test that validates both tasks.

Here, Amazon Q helps the developer choose which libraries to import. Using the arrow keys, the developer toggles through multiple suggestions.

![\[An example of the block completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-1.gif)


Here, the developer enters a comment, describing the code they intend to write on the next line.

Amazon Q correctly anticipates the method to be called. The developer can accept the suggestion with the tab key.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-2.png)


Here, the developer prepares to define constants.

Amazon Q correctly anticipates that the first constant will be `REGION` and that its value will be `us-east-1`, which is the default.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-3.png)


Here, the developer prepares to write code that will open sessions between the user and both Amazon S3 and DynamoDB.

Amazon Q, familiar with AWS APIs and SDKs, suggests the correct format.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-4.1.png)


The developer has merely written the name of the function that will create the bucket. But based on that (and the context), Amazon Q offers a full function, complete with try/except clauses.

Notice the use of `TEST_BUCKET_NAME, which is a constant declared earlier in the same file.`

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-5.png)


The developer has only just begun to type in the name of the function that will create a DynamoDB table. But Amazon Q can tell where this is going.

Notice that the suggestion accounts for the DynamoDB session created earlier, and even mentions it in a comment.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-6.png)


The developer has done little more than write the name of the unit test class, when Amazon Q offers to complete it.

Notice the built-in references to the two functions created earlier in the same file.

The developer has only just begun to type in the name of the function that will create a DynamoDB table. But Amazon Q can tell where this is going.

Notice that the suggestion accounts for the DynamoDB session created earlier, and even mentions it in a comment.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-7.png)


Based only on a comment and the context, Amazon Q supplies the entire main function.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-8.1.png)


All that's left is the main guard, and Amazon Q knows it.

Based only on a comment and the context, Amazon Q supplies the entire main function.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-9.png)


Finally, the developer runs the unit test from the terminal of the same IDE where the coding took place.

![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whatis-demo-10.png)


# Generating inline suggestions in AWS coding environments
<a name="setting-up-AWS-coding-env"></a>

In addition to third-party IDEs, Amazon Q Developer can generate inline suggestions within AWS services that provide their own coding environments.

The following sections describe how to set up Amazon Q inline code suggestions within integrated AWS services.

**Note**  
If you are using Amazon Q as part of an enterprise, then you are using Amazon Q Developer Pro. In that case, administrators at your organization must complete additional steps before you can start coding. For more information, see [Getting started with Amazon Q Developer](getting-started-q-dev.md).

**Topics**
+ [Using Amazon Q Developer with Amazon SageMaker AI Studio](sagemaker-setup.md)
+ [Using Amazon Q Developer with JupyterLab](jupyterlab-setup.md)
+ [Using Amazon Q Developer with Amazon EMR Studio](emr-setup.md)
+ [Using Amazon Q Developer with AWS Glue Studio](glue-setup.md)
+ [Using Amazon Q Developer with AWS Lambda](lambda-setup.md)
+ [Using Amazon Q Developer with other services](other-setup.md)

# Using Amazon Q Developer with Amazon SageMaker AI Studio
<a name="sagemaker-setup"></a>

You can chat with Amazon Q inside Amazon SageMaker AI Studio. You can also make code recommendations automatically as you write your code.

To use Amazon Q Developer with Amazon SageMaker AI Studio, you must add Amazon Q permissions to your SageMaker AI execution role. The way you configure permissions depends on whether you are using the Amazon Q Developer Free tier or the Pro tier.

 To set up and activate Amazon Q for Amazon SageMaker AI Studio, see [Set up Amazon Q Developer for your users](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-jl-admin-guide-set-up.html) in the *Amazon SageMaker AI User Guide*.

# Using Amazon Q Developer with JupyterLab
<a name="jupyterlab-setup"></a>

This page describes how to set up and activate Amazon Q Developer for JupyterLab. Once activated, Amazon Q can make code recommendations automatically as you write your code.

**Note**  
Python is the only programming language that Amazon Q supports in JupyterLab.

## Installing JupyterLab
<a name="jupyterlab-setup-itself"></a>

Install [JupyterLab](https://pypi.org/project/jupyterlab) on your computer or if you already have JupyterLab installed, check its version by running the following command.

```
pip show jupyterlab
```

Note the version in the response, and follow the corresponding directions in one of the following sections.

## Installation using pip for Jupyter Lab version >= 4.0
<a name="jupyterlab-setup-pip-v4"></a>

You can install and enable the Amazon Q extension for JupyterLab 4 with the following commands.

```
# JupyterLab 4
pip install amazon-q-developer-jupyterlab-ext
```

## Installation using pip for Jupyter Lab version >= 3.6 and < 4.0
<a name="jupyterlab-setup-pip-v3"></a>

You can install and enable the Amazon Q extension for JupyterLab 3 with the following commands.

```
# JupyterLab 3
pip install amazon-q-developer-jupyterlab-ext~=3.0
jupyter server extension enable amazon-q-developer-jupyterlab-ext
```

## Authenticating with AWS Builder ID
<a name="jupyterlab-setup-bid"></a>

In the following procedure, you will set up Builder ID, which you will use to authenticate when you enable Amazon Q.

1. Refresh the browser tab on which you are using JupyterLab.

1. From the Amazon Q panel at the bottom of the window, choose **Get Started**.

1. From the pop-up window, choose **Copy Code and Proceed**.

1. On the **Get started** page, sign in or sign up for a Builder ID using your email address or Google account. For more information, see [Getting started with a personal account (Builder ID)](getting-started-builderid.md).

   If you already have a Builder ID, skip to the step about the **Authorize request** page.

1. After you receive your email verification code, enter it in the blank field and choose **Verify**.

1. On the next screen, choose and confirm a password, then choose **Create AWS Builder ID**

1. On the next page choose **Allow** to allow Amazon Q to access your data.

Now you should be logged into Amazon Q in JupyterLab with Builder ID.

To begin coding, see [Using shortcut keys](actions-and-shortcuts.md).

![\[An example of Amazon Q in use with JupyterLab.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/qdev-demo-example.png)


# Using Amazon Q Developer with Amazon EMR Studio
<a name="emr-setup"></a>

This page describes how to set up and activate Amazon Q Developer for Amazon EMR Studio. Once activated, Amazon Q can make code recommendations automatically as you write your ETL code.

**Note**  
Amazon Q supports Python, which can be used to code ETL scripts for Spark jobs in Amazon EMR Studio.

Use the following procedure to set up Amazon EMR Studio to work with Amazon Q.

1. Set up [Amazon EMR Studio Notebook](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-notebooks-create.html).

1. Attach the following policy to the IAM user role for Amazon EMR Studio Notebook.
**Note**  
The `codewhisperer` prefix is a legacy name from a service that merged with Amazon Q Developer. For more information, see [Amazon Q Developer rename - Summary of changes](service-rename.md). 

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "AmazonQDeveloperPermissions",
               "Effect": "Allow",
               "Action": [
                   "codewhisperer:GenerateRecommendations"
               ],
               "Resource": "*"
           }
       ]
   }
   ```

------

1. Open the [Amazon EMR console](https://console.aws.amazon.com/emr).

1. Under Amazon EMR Studio, choose **Workspaces (Notebooks).**

1. Select your desired Workspace and choose **Quick launch**.

# Using Amazon Q Developer with AWS Glue Studio
<a name="glue-setup"></a>

This page describes how to set up and activate Amazon Q Developer for [AWS Glue Studio Notebook](https://docs.aws.amazon.com/glue/latest/ug/notebooks-chapter.html). Once activated, Amazon Q can make code recommendations automatically as you write your ETL code.

**Note**  
Amazon Q supports both Python and Scala, the two languages used for coding ETL scripts for Spark jobs in AWS Glue Studio.

In the following procedure, you will set up AWS Glue to work with Amazon Q.

1. [Set up AWS Glue Studio Notebook](https://docs.aws.amazon.com/glue/latest/ug/notebook-getting-started.html).

1. Attach the following policy to your IAM role for Glue Studio notebook
**Note**  
The `codewhisperer` prefix is a legacy name from a service that merged with Amazon Q Developer. For more information, see [Amazon Q Developer rename - Summary of changes](service-rename.md). 

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "AmazonQDeveloperPermissions",
               "Effect": "Allow",
               "Action": [
                   "codewhisperer:GenerateRecommendations"
               ],
               "Resource": "*"
           }
       ]
   }
   ```

------

1. Open the [Glue console](https://console.aws.amazon.com/glue)

1. Under **ETL jobs**, choose **Notebooks**.

1. Verify that **Jupyter Notebook** is selected. Choose **Create**.

1. Enter a **Job name**.

1. For IAM role, select the role that you configured to interact with Amazon Q

1. Choose **Start notebook**.

# Using Amazon Q Developer with AWS Lambda
<a name="lambda-setup"></a>

This document describes how to set up and activate Amazon Q Developer for the Lambda console. Once activated, Amazon Q can make code recommendations on demand in the Lambda code editor as you develop your function.

**Note**  
In the Lambda console, Amazon Q only supports functions using the Python and Node.js runtimes.

## AWS Identity and Access Management permissions for Lambda
<a name="lambda-q-dev-IAM-policies"></a>

 For Amazon Q to provide recommendations in the Lambda console, you must enable the correct IAM permissions for either your IAM user or role. You must add the `codewhisperer:GenerateRecommendations` permission, as outlined in the sample IAM policy below: 

**Note**  
The `codewhisperer` prefix is a legacy name from a service that merged with Amazon Q Developer. For more information, see [Amazon Q Developer rename - Summary of changes](service-rename.md). 

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AmazonQDeveloperPermissions",
      "Effect": "Allow",
      "Action": ["codewhisperer:GenerateRecommendations"],
      "Resource": "*"
    }
  ]
}
```

------

It is best practice to use IAM policies to grant restrictive permissions to IAM principals. For details about working with IAM for AWS Lambda, see [Identity and access management in AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/security-iam.html) in the *AWS Lambda Developer Guide*.

## Activating Amazon Q Developer with Lambda
<a name="lambda-activation"></a>

To activate Amazon Q in the Lambda console code editor, complete these steps.

1. Open the [Functions page](https://console.aws.amazon.com/lambda/home#/functions) of the Lambda console, and choose the function that you want to edit.

1. As you type in the code editor, automatic code suggestions from Amazon Q are enabled by default. To pause suggestions, choose **Amazon Q** in the bottom left corner of the **Code source** panel. The command palette opens at the top of the Code source panel. From there, choose **Pause auto-suggestions**.

For shortcut keys, see [Using shortcut keys](actions-and-shortcuts.md).

# Using Amazon Q Developer with other services
<a name="other-setup"></a>

## AWS Identity and Access Management permissions for other services
<a name="q-dev-IAM-policies-other"></a>

 For Amazon Q to provide recommendations in the context of another service, you must enable the correct IAM permissions for either your IAM user or role. You must add the `codewhisperer:GenerateRecommendations` permission, as outlined in the sample IAM policy below: 

**Note**  
The `codewhisperer` prefix is a legacy name from a service that merged with Amazon Q Developer. For more information, see [Amazon Q Developer rename - Summary of changes](service-rename.md). 

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AmazonQDeveloperPermissions",
      "Effect": "Allow",
      "Action": ["codewhisperer:GenerateRecommendations"],
      "Resource": "*"
    }
  ]
}
```

------

It is best practice to use IAM policies to grant restrictive permissions to IAM principals. For details about working with IAM, see [Security best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) in the *IAM user guide*. 

# Using shortcut keys
<a name="actions-and-shortcuts"></a>

While getting inline suggestions from Amazon Q, you can use keyboard shortcuts for common actions you take, such as initiating Amazon Q or accepting a recommendation.

Choose the integrated development environment (IDE) where you are developing code to see keyboard shortcuts for your IDE. 

------
#### [ Visual Studio Code ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  Right arrow  | 
|  Previous recommendation  |  Left arrow  | 
|  Reject a recommendation  |  ESC, backspace, or keep typing and the recommendation will disappear as soon as there is a character mismatch.  | 
|  Accept next word  |  Cmd \$1 right arrow  | 

To change keybindings in VS Code, see [Key Bindings for Visual Studio Code](https://code.visualstudio.com/docs/getstarted/keybindings) on the VS Code website.

**Note**  
The inline suggestions toolbar in VS Code is disabled by default. For more information, see [Redesigned inline suggestions toolbar](https://code.visualstudio.com/updates/v1_75#_redesigned-inline-suggestions-toolbar) on the VS Code website.

------
#### [ JetBrains ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  Right arrow  | 
|  Previous recommendation  |  Left arrow  | 
|  Reject a recommendation  |  ESC, backspace, or keep typing and the recommendation will disappear as soon as there is a character mismatch.  | 

To change keybindings in IntelliJ, see [IntelliJ IDEA keyboard shortcuts](https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html) on the JetBrains website.

------
#### [ Eclipse ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  MacOS: Option \$1 ] Windows: Alt \$1 ]  | 
|  Previous recommendation  |  MacOS: Option \$1 [ Windows: Alt \$1 [  | 
|  Reject a recommendation  |  ESC, backspace, or keep typing and the recommendation will disappear as soon as there is a character mismatch.  | 

To change keybindings in Eclipse, see [Changing the key bindings ](https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftkeybindings.htm) in the Eclipse documentation.

------
#### [ Toolkit for Visual Studio ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q `AWSToolkit.CodeWhisperer.GetSuggestion` in the keybindings  |  Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation `Edit.NextSuggestion` in the keybindings  |  Windows: Alt \$1 .  | 
|  Previous recommendation `Edit.PreviousSuggestion` in the keybindings  |  Windows: Alt \$1 ,  | 
|  Reject a recommendation  |  ESC, backspace, or keep typing and the recommendation will disappear as soon as there is a character mismatch.  | 

See also Microsoft's [Visual Studio default keyboard shortcuts](https://visualstudio.microsoft.com/keyboard-shortcuts.pdf).

To change keybindings in Visual Studio, use Tools -> Options -> Keyboard.

------
#### [ Amazon SageMaker AI ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  Down arrow  | 
|  Previous recommendation  |  Up arrow  | 
|  Reject a recommendation  |  ESC  | 

------
#### [ JupyterLab ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  Down arrow  | 
|  Previous recommendation  |  Up arrow  | 
|  Reject a recommendation  |  ESC  | 

------
#### [ AWS Glue Studio Notebook ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually initiate Amazon Q  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a recommendation  |  Tab  | 
|  Next recommendation  |  Down arrow  | 
|  Previous recommendation  |  Up arrow  | 
|  Reject a recommendation  |  ESC  | 

------
#### [ AWS Lambda ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually fetch a code suggestion  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a suggestion  |  Tab  | 
|  Reject a suggestion  |  ESC, Backspace, scroll in any direction, or keep typing and the recommendation automatically disappears.  | 

To change the key bindings, use the following procedure.

1. While viewing a particular function, choose the gear icon to open the **Preferences** tab.

1. On the **Preferences** tab, select **Keybindings**.

1. In the keybindings search box, enter Amazon Q.

![\[Keybindings settings in AWS Cloud9 IDE with Amazon CodeWhisperer option highlighted.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/CWSPR-Lambda-keybinding-settings.png)


------
#### [ AWS Cloud9 ]


| Action | Keyboard shortcut | 
| --- | --- | 
|  Manually fetch a code suggestion  |  MacOS: Option \$1 C Windows: Alt \$1 C  | 
|  Accept a suggestion  |  Tab  | 
|  Reject a suggestion  |  ESC, Backspace, scroll in any direction, or keep typing and the recommendation automatically disappears.  | 

1. While viewing a particular environment, choose the gear icon to open the **Preferences** tab.

1. On the **Preferences** tab, select **Keybindings**.

1. In the keybindings search box, enter Amazon Q.

1. In the Keystroke column, double-click the space corresponding to the function you're interested in.

1. Enter the keys that you want to bind the function to.

![\[AWS Cloud9 interface showing Keybindings settings with options for keyboard mode and custom keybindings.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/CWSPR-C9-keybinding-settings.png)


------

# Using code references
<a name="code-reference"></a>

Amazon Q learns, in part, from open-source projects. Sometimes, a suggestion it's giving you may be similar to publicly available code. Code references include information about the source Amazon Q used to generate a recommendation.

**Topics**
+ [View and update code references](#show-code-reference)
+ [Turn code references off and on](#toggle-code-reference)
+ [Opt out of code with references](#opt-out-code-reference)

## View and update code references
<a name="show-code-reference"></a>

With the reference log, you can view references to code recommendations that are similar to publicly available code. You can also update and edit code recommendations suggested by Amazon Q.

Choose your IDE to see steps for how to view and update code references. 

------
#### [ Visual Studio Code ]

To display the Amazon Q reference log in VS Code, use the following procedure.

1. Make sure you are using the latest version of both VS Code and the Amazon Q extension. 

1. In VS Code, choose **Amazon Q** from the component tray at the bottom of the IDE window.

   The Amazon Q task bar opens at the top of the IDE window. 

1. Choose **Open Code Reference Log**.

   The code reference log tab opens. Any references to code recommendations are listed.

The following image shows the open Amazon Q task bar and code reference log tab.

![\[The Amazon Q code reference log in Visual Studio Code.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/VSC-coderef.png)


------
#### [ JetBrains ]

To display the Amazon Q reference log in JetBrains IDEs, use the following procedure.

1. Make sure you are using the latest version of both your JetBrains IDE and the Amazon Q plugin. 

1. In JetBrains, choose **Amazon Q** from the status bar at the bottom of the IDE window.

   The Amazon Q task bar opens above the status bar. 

1. Choose **Open Code Reference Log**.

   The code reference log tab opens. Any references to code recommendations are listed.

The following image shows the open Amazon Q task bar and code reference log tab.

![\[The Amazon Q code reference log in JetBrains.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/JB-coderef.png)


------
#### [ Eclipse ]

To display the Amazon Q reference log in Eclipse IDEs, use the following procedure.

1. Make sure you are using the latest version of both the Eclipse IDE and the Amazon Q plugin. 

1. In your Eclipse IDE, choose the **Amazon Q** icon in the top right corner of the IDE. 

1. With the Amazon Q chat tab open, choose the ellipsis icon in the top right corner of the tab. The Amazon Q task bar opens.

   The following image shows the Amazon Q task bar in an Eclipse IDE.  
![\[The Amazon Q task bar in an Eclipse IDE.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/eclipse-taskbar.png)

1. Choose **Open Code Reference Log**.

   The code reference log tab opens. Any references to code recommendations are listed.

------
#### [ Toolkit for Visual Studio ]

When Amazon Q suggests code that contains a reference in the Toolkit for Visual Studio, the reference type appears in the suggestion description.

![\[Code snippet showing a function to create a DynamoDB table with 'Products' as the table name.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/visual-studio-view-code-suggestions.png)


All accepted suggestions that contain references are captured in the reference log.

To access the reference log, choose the AWS icon, then select **Open Code Reference Log**.

A list of accepted suggestions that contain references will appear. This list includes:
+ The location where the suggestion was accepted. Double clicking on this will take you to that location in your code.
+ The associated license
+ The referenced source code
+ The fragment of code attributed to the reference

![\[CodeWhisperer Reference Log output showing accepted recommendation with MIT license.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/vstudio-reference-log2.png)


------
#### [ AWS Cloud 9 ]

When you use Amazon Q with AWS Cloud 9, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. On the AWS Cloud 9 console, in the upper left corner, choose the AWS Cloud 9 logo.

1. From the dropdown menu, choose **Preferences**.

   On the right side of the console, the **Preferences** tab will open.

1. On the **Preferences** tab, under **Project Settings**, under **Extensions**, select **AWS Toolkit**.

1. Select or deselect **Amazon Q: Include Suggestions With Code References**.

------
#### [ Lambda ]

Amazon Q in Lambda does not support code references. When you use Amazon Q with Lambda, any code suggestions with references are omitted.

------
#### [ SageMaker AI Studio ]

To display the Amazon Q reference log in SageMaker AI Studio, use the following procedure.

1. At the bottom of the SageMaker AI Studio window, open the Amazon Q panel.

1. Choose **Open Code Reference Log**.

------
#### [ JupyterLab ]

To display the Amazon Q reference log in JupyterLab, use the following procedure.

1. At the bottom of the JupyterLab window, open the Amazon Q panel.

1. Choose **Open Code Reference Log**.

------
#### [ AWS Glue Studio Notebook ]

To display the Amazon Q reference log in AWS Glue Studio Notebook, use the following procedure.

1. At the bottom of the AWS Glue Studio Notebook window, open the Amazon Q panel.

1. Choose **Open Code Reference Log**.

------

## Turn code references off and on
<a name="toggle-code-reference"></a>

In most IDEs, code references are on by default. Choose your IDE to see steps for how to turn code references off or on. 

------
#### [ Visual Studio Code ]

When you use Amazon Q with VS Code, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. Make sure you are using the latest version of both VS Code and the Amazon Q extension. 

1. In VS Code, choose **Amazon Q** from the component tray at the bottom of the IDE window.

   The Amazon Q task bar opens at the top of the IDE window. 

1. Choose **Open Settings**. The settings tab opens with the options related to Amazon Q displayed.

1. Select or deselect the box next to **Show Code With References**.

------
#### [ JetBrains ]

When you use Amazon Q with your JetBrains IDE, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. Make sure you are using the latest version of both your JetBrains IDE and the Amazon Q plugin. 

1. In JetBrains, choose **Amazon Q** from the status bar at the bottom of the IDE window.

   The Amazon Q task bar opens above the status bar. 

1. Choose **Open Settings**. The settings window opens with the options related to Amazon Q displayed. 

1. Select or deselect the box next to **Show Code With References**.

------
#### [ Eclipse ]

When you use Amazon Q with Eclipse, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. Make sure you are using the latest version of both the Eclipse IDE and the Amazon Q plugin. 

1. Open **Settings** in your Eclipse IDE.

1. Choose **Amazon Q** from the left navigation bar.

1. Select or deselect the box next to **Show Code With References**.

1. Choose **Apply** to save your changes.

------
#### [ Toolkit for Visual Studio ]

When you use Amazon Q in the Toolkit for Visual Studio, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. Make sure you are using the latest version of the Toolkit for Visual Studio. 

1. Open **Options** in Visual Studio.

1. Choose **AWS Toolkit** from the left navigation bar, and then choose **Amazon Q**.

1. From the dropdown next to **Include Suggestions With References**, select True or False.

1. Choose **OK** to save your changes.

------
#### [ AWS Cloud 9 ]

When you use Amazon Q with AWS Cloud 9, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. On the AWS Cloud 9 console, in the upper left corner, choose the AWS Cloud 9 logo.

1. From the dropdown menu, choose **Preferences**.

   On the right side of the console, the **Preferences** tab will open.

1. On the **Preferences** tab, under **Project Settings**, under **Extensions**, select **AWS Toolkit**.

1. Select or deselect **Amazon Q: Include Suggestions With Code References**.

------
#### [ Lambda ]

Amazon Q in Lambda does not support code references. When you use Amazon Q with Lambda, any code suggestions with references are omitted.

------
#### [ SageMaker AI Studio ]

When you use Amazon Q with SageMaker AI Studio, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. From the top of the SageMaker AI Studio window choose **Settings**.

1. From the **Settings** dropdown, choose **Advanced Settings Editor**.

1. In the Amazon Q dropdown, select or deselect the box next to **Enable suggestions with code references**.

------
#### [ JupyterLab ]

When you use Amazon Q with JupyterLab, code references are on by default.

To turn them off, or to turn them back on later, use the following procedure.

1. From the top of the JupyterLab window choose **Settings**.

1. From the **Settings** dropdown, choose **Advanced Settings Editor**.

1. In the Amazon Q dropdown, select or deselect the box next to **Enable suggestions with code references**.

------
#### [ AWS Glue Studio Notebook ]

1. From the bottom of the AWS Glue Studio Notebook window choose **Amazon Q**.

1. From the pop-up menu, toggle the switch next to **Code with references**.

**Note**  
Pausing code references will be valid only for the duration of the current AWS Glue Studio Notebook.

------

## Opt out of code with references
<a name="opt-out-code-reference"></a>

In some IDEs, you can opt out of receiving suggestions with references at the administrator level.

Choose your IDE to see steps for opting out as an administrator.

------
#### [ Visual Studio Code ]

If you are an enterprise administrator, you can opt out of suggestions with code references for your entire organization. If you do this, individual developers in your organization will not be able to opt back in through the IDE. Those developers will be able to select and deselect the box discussed in the previous section, but it will have no effect if you have opted out at the enterprise level.

To opt out of suggestions with references at the enterprise level, use the following procedure.

1. In the Amazon Q Developer console, choose **Settings**. 

1. In the **Amazon Q Developer account details** pane, choose **Edit**.

1. On the Edit details page, in the **Advanced settings** pane, deselect **Include suggestions with code references**.

1. Choose **Save changes**.

------
#### [ JetBrains ]

If you are an enterprise administrator, you can opt out of suggestions with code references for your entire organization. If you do this, individual developers in your organization will not be able to opt back in through the IDE. Those developers will be able to select and deselect the box discussed in the previous section, but it will have no effect if you have opted out at the enterprise level.

To opt out of suggestions with references at the enterprise level, use the following procedure.

1. In the Amazon Q Developer console, choose **Settings**. 

1. In the **Amazon Q Developer account details** pane, choose **Edit**.

1. On the Edit details page, in the **Advanced settings** pane, deselect **Include suggestions with code references**.

1. Choose **Save changes**.

------
#### [ Eclipse ]

If you are an enterprise administrator, you can opt out of suggestions with code references for your entire organization. If you do this, individual developers in your organization will not be able to opt back in through the IDE. Those developers will be able to select and deselect the box discussed in the previous section, but it will have no effect if you have opted out at the enterprise level.

To opt out of suggestions with references at the enterprise level, use the following procedure.

1. In the Amazon Q Developer console, choose **Settings**. 

1. In the **Amazon Q Developer account details** pane, choose **Edit**.

1. On the Edit details page, in the **Advanced settings** pane, deselect **Include suggestions with code references**.

1. Choose **Save changes**.

------
#### [ Toolkit for Visual Studio ]

To opt out of suggestions with references at the enterprise level, use the following procedure. 

1. You can get to the code references setting in one of two ways:

   1. Choose the Amazon Q icon at the edge of the window, and then choose **Options...**

   1. Go to **Tools** -> **AWS Toolkit** -> **Amazon Q**

1. Change the toggle to **True** or **False**, depending on whether you want to include suggestions with references.

------
#### [ AWS Cloud 9 ]

Amazon Q in AWS Cloud 9 does not support opting out of code suggestions with references at the enterprise level.

To opt out at the individual developer level, see Toggling code references.

------
#### [ Lambda ]

Amazon Q in Lambda does not support code references. When you use Amazon Q with Lambda, any code suggestions with references are omitted.

------
#### [ SageMaker AI Studio ]

Amazon Q does not support opting out of code suggestions with references at the enterprise level in SageMaker AI Studio.

------
#### [ JupyterLab ]

Amazon Q does not support opting out of code suggestions with references at the enterprise level in JupyterLab.

------
#### [ AWS Glue Studio Notebook ]

Amazon Q does not support opting out of code suggestions with references in AWS Glue Studio Notebook.

------

# Code examples
<a name="inline-suggestions-code-examples"></a>

Amazon Q can suggest code in different scenarios. To understand how it can help you as you write code in your programming language of choice, view the following code examples.

**Topics**
+ [Using Amazon Q Developer for single-line code completion](single-line-completion.md)
+ [Using Amazon Q Developer for full function generation](full-function-generation.md)
+ [Using Amazon Q Developer for block completion](code-block.md)
+ [Using Amazon Q Developer for Docstring, JSDoc, and Javadoc completion](docstring-javadoc.md)
+ [Using Amazon Q Developer for line-by-line recommendations](line-by-line-1.md)

# Using Amazon Q Developer for single-line code completion
<a name="single-line-completion"></a>

When you start typing out single lines of code, Amazon Q makes suggestions based on your current and previous inputs.

------
#### [ C\$1\$1 ]

![\[An example of the single-line completion feature using C++.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/single-line-completion-c-plus.gif)


------
#### [ JavaScript ]

In this example, Amazon Q completes a line of code that the developer begins.

![\[An example of the single-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/javascript_vscode_SingleLine.gif)


------
#### [ TypeScript ]

In this example, the user enters a full comment, and then Amazon Q supplies the code that goes with it.

![\[An example of the single-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/typescript_vscode_single-line.gif)


------
#### [ C\$1 ]

In this example, Amazon Q provides a single-line recommendation based on a comment.

![\[An example of the single line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/c-sharp-single-line.gif)


------
#### [ Shell ]

In the image below, Amazon Q offers recommendations on how to complete a single line of code.

![\[An example of the single-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/jb-single-line-shell.gif)


------
#### [ Java ]

When you start typing out single lines of code, Amazon Q makes suggestions based on your current and previous inputs.

In the example below, in Java, a user enters the string `public` into an existing class.

Based on the input, Amazon Q generates a suggestion for the signature of the main method. 

![\[An example of the single-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-c9-single-line-completion.gif)


------
#### [ Python ]

In this example, Amazon Q recommends a single line of code, based on the developer's comment. 

![\[An example of the single-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_singleline.gif)


------

# Using Amazon Q Developer for full function generation
<a name="full-function-generation"></a>

Amazon Q can generate an entire function based on a comment that you've written. As you finish your comment Amazon Q will suggest a function signature. If you accept the suggestion, Amazon Q automatically advances your cursor to the next part of the function and makes a suggestion. Even if you enter an additional comment or line of code in between suggestions, Amazon Q will refactor based on your input.

------
#### [ C ]

![\[An example of the full function completion feature using C.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/full-function-completion-c-plus.gif)


------
#### [ C\$1\$1 ]

![\[An example of the full function completion feature using C++.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/full-function-completion-c-plus.gif)


------
#### [ JavaScript ]

In the following example, the user generates, and then edits, a full function based on a set of comments.

![\[An example of the full-function generation feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/javascript_lambda_FullFunctionGeneration.gif)


In the following image, a user has written a function signature for reading a file from Amazon S3. Amazon Q then suggests a full implementation of the `read_from_s3` method.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-function-read-from-s3.png)


**Note**  
Sometimes, as in the previous example, Amazon Q includes `import` statements as part of its suggestions. As a best practice, manually move these `import` statements to the top of your file.

As another example, in the following image, a user has written a function signature. Amazon Q then suggests a full implementation of the `quicksort` method.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-function-quicksort.png)


Amazon Q considers past code snippets when making suggestions. In the following image, the user in the previous example has accepted the suggested implementation for `quicksort` above. The user then writes another function signature for a generic `sort` method. Amazon Q then suggests an implementation based on what has already been written.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-function-from-context-sort.png)


In the following image, a user has written a comment. Based on this comment, Amazon Q then suggests a function signature.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-comment-binary-search.png)


In the following image, the user in the previous example has accepted the suggested function signature. Amazon Q can then suggest a complete implementation of the `binary_search` function.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-function-binary-search.png)


------
#### [ Java ]

The following list contains examples of how Amazon Q makes suggestions and advances you through the entire process of creating a function.

1. In the following example, a user inputs a comment. Amazon Q suggests a function signature.

   After the user accepts that suggestion, Amazon Q suggests a function body.  
![\[An example of a function generated from a comment.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-c9-function-from-comment.gif)

1. In the image below, a user inputs a comment in the body of the function prior to accepting a suggestion from Amazon Q. On the following line, Amazon Q generates a suggestion based on the comment.  
![\[An example of a function generated from a comment inside an existing block of code.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-c9-function-from-comment-within-block.gif)

------
#### [ C\$1 ]

In the following example, Amazon Q recommends a full function.

![\[Function declaration for ListTables with AmazonDynamoDBClient parameter in code editor.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/c-sharp-full-function.gif)


------
#### [ TypeScript ]

In the following example, Amazon Q generates a function based on the user's docstrings.

![\[An example of the full function completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/typescript_vscode_function.gif)


------
#### [ Python ]

Amazon Q can generate an entire function based on a comment that you've written. As you finish your comment, Amazon Q will suggest a function signature. If you accept the suggestion, Amazon Q automatically advances your cursor to the next part of the function and makes a suggestion. Even if you enter an additional comment or line of code in between suggestions, Amazon Q will refactor based on your input.

In the following example, Amazon Q generates both a full function and the corresponding unit test.

![\[An example of the full function completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_pycharm_fullfunction_unittests.GIF)


The following list contains examples of how Amazon Q makes suggestions and advances you through the entire process of creating a function.

1. In the image below, a user has input a comment. The function signature, located below the comment, is a suggestion from Amazon Q.  
![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-jb-comment-062022.png)

1. In the image below, the user has accepted the Amazon Q suggestion for a function signature. Accepting the suggestion automatically advanced the cursor and Amazon Q has made a new suggestion for the function body.  
![\[alt_text\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-jb-commentfunctionadvance-062022.png)

1. In the image below, a user input a comment in the body of the function prior to accepting a suggestion from Amazon Q. On the following line, Amazon Q has generated a new suggestion based on the content of the comment.  
![\[generateing a new suggestion based on the content of a comment\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-jb-commentfunction-062022.png)

In this example, Amazon Q recommends a full function after the user types part of the signature. 

![\[An example of the full function feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_fullfunction.gif)


------

# Using Amazon Q Developer for block completion
<a name="code-block"></a>

Block completion is used to complete your `if/for/while/try` code blocks.

------
#### [ C ]

![\[An example of the block completion feature using C\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/block-completion-c.gif)


------
#### [ C\$1\$1 ]

![\[An example of the block completion feature using C++.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/block-completion-c-plus.gif)


------
#### [ Java ]

In the example below, a user enters the signature of an `if` statement. The body of the statement is a suggestion from Amazon Q.

![\[An example of the block completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-c9-block-completion.gif)


------
#### [ C\$1 ]

In the image below, Amazon Q recommends a way to complete the function.

![\[An example of the block completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/c-sharp-block.gif)


------
#### [ TypeScript ]

In the image below, Amazon Q recommends a way to complete the function.

![\[An example of the block completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/typescript_vscode_block-completion.gif)


------
#### [ Python ]

In this example, Amazon Q recommends a block of code, based on the context. 

![\[An example of the code block feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_codeblock.gif)


------

# Using Amazon Q Developer for Docstring, JSDoc, and Javadoc completion
<a name="docstring-javadoc"></a>

Amazon Q can help you generate or complete documentation inside your code.

------
#### [ C\$1\$1 ]

![\[An example of the docstring completion feature using C++.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/docstring-completion-c-plus.gif)


------
#### [ Javascript ]

In this example, Amazon Q fills in JSDoc parameters based on existing constants.

![\[An example of JSDoc completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/javascript_vscode_JSDocCompletion.gif)


------
#### [ C\$1 ]

In this example, Amazon Q fills in JSDoc parameters based on existing constants.

![\[An example of C3 with DocString completion.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/c-sharp-docstring.gif)


------
#### [ Java ]

The following example is adapted from [an example on the Oracle website](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html).

In the image below, the user has started entering a docstring. Amazon Q has suggested words to add to the docstring.

![\[suggesting a function to complete a docstring\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/jb-docstring-java.png)


The following example is adapted from [an example on the Oracle website](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html).

In the example below, in Java, the user enters a docstring. Amazon Q suggests a function to process the docstring.

![\[An example of code completion based on a Javadoc.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/cw-c9-javadoc.gif)


------
#### [ Python ]

In this example, Amazon Q recommends a Docstring, based on the surrounding context. 

![\[An example of the Docstring feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_commentblock.gif)


------

# Using Amazon Q Developer for line-by-line recommendations
<a name="line-by-line-1"></a>

Depending on your use case, Amazon Q may not be able to generate an entire function block in one recommendation. However, Amazon Q can still provide line-by-line recommendations.

------
#### [ Go and GoLand ]

In this example, Amazon Q provides line-by-line recommendations.

![\[An example of the line-by-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-go.gif)


Here is another example of line-by-line recommendations, this time with a unit test.

![\[An example of the line-by-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-unit-test-go.gif)


------
#### [ C\$1\$1 and CLion ]

In this example, Amazon Q provides line-by-line recommendations.

![\[An example of the line-by-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-cpp.gif)


------
#### [ Python ]

In the following image, the customer has written an initial comment indicating that they want to publish a message to an Amazon CloudWatch Logs group. Given this context, Amazon Q is only able to suggest the client initialization code in its first recommendation, as shown in the following image.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-1.png)


However, if the user continues to request line-by-line recommendations, Amazon Q also continues to suggest lines of code based on what's already been written.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-2.png)


**Note**  
In the example above, `VPCFlowLogs` may not be the correct constant value. As Amazon Q makes suggestions, remember to rename any constants as required.

Amazon Q can eventually complete the entire code block as shown in the following image.

![\[\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-3.png)


In this example, Amazon Q provides recommendations, one line at at time.

![\[An example of the line-by-line completion feature.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_linebyline.gif)


------