Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(amazonq): User can view file diff by file click #6383

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "`/test`: view diffs by clicking files in the file tree, aligning the behavior with the 'View Diff' button."
}
47 changes: 38 additions & 9 deletions packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TabsStorage, TabType } from '../storages/tabsStorage'
import { TestMessageType } from '../../../../amazonqTest/chat/views/connector/connector'
import { ChatPayload } from '../connector'
import { BaseConnector, BaseConnectorProps } from './baseConnector'
import { FollowUpTypes } from '../../../commons/types'

export interface ConnectorProps extends BaseConnectorProps {
sendMessageToExtension: (message: ExtensionMessage) => void
Expand Down Expand Up @@ -107,15 +108,43 @@ export class Connector extends BaseConnector {
}

onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => {
// TODO: add this back once we can advance flow from here
dogusata marked this conversation as resolved.
Show resolved Hide resolved
// this.sendMessageToExtension({
// command: 'open-diff',
// tabID,
// filePath,
// deleted,
// messageId,
// tabType: 'testgen',
// })
if (this.onChatAnswerReceived === undefined) {
return
}
// Open diff view
this.sendMessageToExtension({
command: 'open-diff',
tabID,
filePath,
deleted,
messageId,
tabType: 'testgen',
})
this.onChatAnswerReceived(
tabID,
{
type: ChatItemType.ANSWER,
messageId: messageId,
followUp: {
text: ' ',
options: [
{
type: FollowUpTypes.AcceptCode,
pillText: 'Accept',
status: 'success',
icon: MynahIcons.OK,
},
{
type: FollowUpTypes.RejectCode,
pillText: 'Reject',
status: 'error',
icon: MynahIcons.REVERT,
},
],
},
},
{}
)
}

private processChatMessage = async (messageData: any): Promise<void> => {
Expand Down
Loading