Line-by-line recommendations - CodeWhisperer

CodeWhisperer's features are becoming a part of Amazon Q Developer. Learn more

Line-by-line recommendations

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

JetBrains

In this example using Go and GoLand, CodeWhisperer provides line-by-line recommendations.

An example of the line-by-line completion feature.

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

An example of the line-by-line completion feature.

In this example, CodeWhisperer provides line-by-line recommendations using C++ and CLion.

An example of the line-by-line completion feature.
Lambda

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, CodeWhisperer is only able to suggest the client initialization code in its first recommendation, as shown in the following image.

A screenshot that shows the first CodeWhisperer recommendation when prompted for a function that publishes messages to a CloudWatch Logs log group.

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

A screenshot that shows the next few CodeWhisperer recommendations that begin to form the implementation the function to publish messages to a CloudWatch Logs log group.
Note

In the example above, VPCFlowLogs may not be the correct constant value. As CodeWhisperer makes suggestions, remember to rename any constants as required.

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

A screenshot that shows the completed implementation of a code block that publishes messages to a CloudWatch Logs log group, based only on CodeWhisperer recommendations.
SageMaker Studio

In this example using Python and SageMaker Studio, CodeWhisperer provides recommendations, one line at at time.

An example of the line-by-line completion feature.