

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Amazon Q Developer 提供逐行建議
<a name="line-by-line-1"></a>

根據您的使用案例，Amazon Q 可能無法在一個建議中產生完整的函數區塊。不過，Amazon Q 仍然可以提供逐行建議。

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

在此範例中，Amazon Q 會提供逐行建議。

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


以下是另一個逐行建議的範例，這次是單元測試。

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


------
#### [ C\+\+ and CLion ]

在此範例中，Amazon Q 會提供逐行建議。

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


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

在下圖中，客戶已撰寫初始註解，指出要將訊息發佈到 Amazon CloudWatch Logs 群組。根據此內容，Amazon Q 只能在第一個建議中建議用戶端初始化程式碼，如下圖所示。

![螢幕擷取畫面中顯示提示將訊息發佈至 CloudWatch Logs 日誌群組的函式時，Amazon Q 提出的第一個建議。](http://docs.aws.amazon.com/zh_tw/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-1.png)


不過，如果使用者繼續請求逐行建議，Amazon Q 也會繼續根據已編寫的內容來建議各行程式碼。

![螢幕擷取畫面中顯示後續幾個 Amazon Q 建議，開始形成將訊息發佈到 CloudWatch Logs 日誌群組的函式實作。](http://docs.aws.amazon.com/zh_tw/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-2.png)


**注意**  
在以上範例中，`VPCFlowLogs` 可能不是正確的常數值。當 Amazon Q 提出建議時，別忘了視需要重新命名任何常數。

Amazon Q 最終可完成整個程式碼區塊，如下圖所示。

![螢幕擷取畫面中顯示完全根據 Amazon Q 建議完成的程式碼區塊實作，可將訊息發佈至 CloudWatch Logs 日誌群組。](http://docs.aws.amazon.com/zh_tw/amazonq/latest/qdeveloper-ug/images/whisper-line-by-line-cwlogs-3.png)


在此範例中，Amazon Q 會一次一行提供建議。

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


------