

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Amazon Q 开发者版提供逐行建议
<a name="line-by-line-1"></a>

根据具体使用案例，Amazon Q 可能无法在一个建议中生成完整的函数块。但是，Amazon Q 仍然可以提供逐行建议。

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

在此示例中，Amazon Q 提供了逐行建议。

![\[逐行完成功能的示例。\]](http://docs.aws.amazon.com/zh_cn/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-go.gif)


这是逐行建议的另一个示例，这次是单元测试。

![\[逐行完成功能的示例。\]](http://docs.aws.amazon.com/zh_cn/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-unit-test-go.gif)


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

在此示例中，Amazon Q 提供了逐行建议。

![\[逐行完成功能的示例。\]](http://docs.aws.amazon.com/zh_cn/amazonq/latest/qdeveloper-ug/images/jb-line-by-line-cpp.gif)


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

在下图中，客户编写了一条初步注释，表示他们希望向某个 Amazon CloudWatch Logs 组发布一条消息。鉴于这一上下文，Amazon Q 只能在第一个建议中提出客户端初始化代码建议，如下图所示。

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


但是，如果用户继续请求逐行建议，Amazon Q 还会继续根据已经编写的代码提出代码行建议。

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


**注意**  
在上例中，`VPCFlowLogs` 可能不是正确的常量值。在 Amazon Q 提出建议的同时，务必要注意根据需要重命名任何常量。

Amazon Q 最终可以完成整个代码块，如下图所示。

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


在此示例中，Amazon Q 提供了逐行建议。

![\[逐行完成功能的示例。\]](http://docs.aws.amazon.com/zh_cn/amazonq/latest/qdeveloper-ug/images/python_sagemakerstudio_linebyline.gif)


------