Skip to content

Commit bf63747

Browse files
authored
fix(amazonq): add event publisher for generateUnitTests (aws#7198)
## Problem `aws.amazonq.generateUnitTests` is not sending any events to /review ## Solution publish a chat message event to the /review tab to start I forgot to include these changes in aws#7195 --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 7fd3bf2 commit bf63747

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/amazonq/src/lsp/chat/commands.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { window } from 'vscode'
88
import { AmazonQChatViewProvider } from './webviewProvider'
99
import { CodeScanIssue } from 'aws-core-vscode/codewhisperer'
1010
import { EditorContextExtractor } from 'aws-core-vscode/codewhispererChat'
11+
import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
1112

1213
/**
1314
* TODO: Re-enable these once we can figure out which path they're going to live in
@@ -19,6 +20,13 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
1920
registerGenericCommand('aws.amazonq.refactorCode', 'Refactor', provider),
2021
registerGenericCommand('aws.amazonq.fixCode', 'Fix', provider),
2122
registerGenericCommand('aws.amazonq.optimizeCode', 'Optimize', provider),
23+
Commands.register('aws.amazonq.generateUnitTests', async () => {
24+
DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessagePublisher().publish({
25+
sender: 'testChat',
26+
command: 'test',
27+
type: 'chatMessage',
28+
})
29+
}),
2230
Commands.register('aws.amazonq.explainIssue', async (issue: CodeScanIssue) => {
2331
void focusAmazonQPanel().then(async () => {
2432
const editorContextExtractor = new EditorContextExtractor()

packages/core/src/codewhispererChat/commands/registerCommands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export function registerCommands() {
4040
/**
4141
* make these no-ops, since theres still callers that need to be deprecated
4242
*/
43-
Commands.register('aws.amazonq.generateUnitTests', async (data) => {})
4443
Commands.register('aws.amazonq.updateContextCommandItems', () => {})
4544
}
4645

0 commit comments

Comments
 (0)