Skip to content

Commit 3dba25e

Browse files
authored
refactor(codewhisperer): simplify isValidResponse() #4251
This matches the logic at hasAtLeastOneValidSuggestion(). https://github.com/aws/aws-toolkit-vscode/blob/8e40b708235a4569aabca6209ecafdb4f909b498/src/codewhisperer/service/recommendationHandler.ts#L419-L421
1 parent f56978d commit 3dba25e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/codewhisperer/service/recommendationHandler.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ export class RecommendationHandler {
101101
}
102102

103103
isValidResponse(): boolean {
104-
return (
105-
session.recommendations !== undefined &&
106-
session.recommendations.length > 0 &&
107-
session.recommendations.filter(option => option.content.length > 0).length > 0
108-
)
104+
return session.recommendations.some(r => r.content.trim() !== '')
109105
}
110106

111107
async getServerResponse(

0 commit comments

Comments
 (0)