Skip to content

Commit de3c246

Browse files
authored
feat(amazonq): Re-enable generate unit tests command and context menu item (#5699)
## Problem Command and context menu item for unit test generation was disabled for internal users before last release. We are ready to enable now. ## Solution This PR enables the context menu item and commands for unit test generation.
1 parent 5f68d0e commit de3c246

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/amazonq/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
{
354354
"command": "aws.amazonq.generateUnitTests",
355355
"group": "cw_chat@5",
356-
"when": "false"
356+
"when": "aws.codewhisperer.connected && aws.isInternalUser"
357357
},
358358
{
359359
"command": "aws.amazonq.sendToPrompt",
@@ -433,7 +433,7 @@
433433
"command": "aws.amazonq.generateUnitTests",
434434
"title": "%AWS.command.amazonq.generateUnitTests%",
435435
"category": "%AWS.amazonq.title%",
436-
"enablement": "false"
436+
"enablement": "aws.codewhisperer.connected && aws.isInternalUser"
437437
},
438438
{
439439
"command": "aws.amazonq.reconnect",
@@ -616,7 +616,7 @@
616616
"key": "win+alt+t",
617617
"mac": "cmd+alt+t",
618618
"linux": "meta+alt+t",
619-
"when": "false"
619+
"when": "aws.codewhisperer.connected && aws.isInternalUser"
620620
},
621621
{
622622
"command": "aws.amazonq.invokeInlineCompletion",

packages/core/src/codewhispererChat/controllers/chat/userIntent/userIntentRecognizer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { UserIntent } from '@amzn/codewhisperer-streaming'
77
import { EditorContextCommand } from '../../../commands/registerCommands'
88
import { PromptMessage } from '../model'
9+
import { Auth } from '../../../../auth'
910

1011
export class UserIntentRecognizer {
1112
public getFromContextMenuCommand(command: EditorContextCommand): UserIntent | undefined {
@@ -38,6 +39,8 @@ export class UserIntentRecognizer {
3839
return UserIntent.APPLY_COMMON_BEST_PRACTICES
3940
} else if (prompt.message.startsWith('Optimize')) {
4041
return UserIntent.IMPROVE_CODE
42+
} else if (prompt.message.startsWith('Generate unit tests') && Auth.instance.isInternalAmazonUser()) {
43+
return UserIntent.GENERATE_UNIT_TESTS
4144
}
4245
return undefined
4346
}

0 commit comments

Comments
 (0)