in packages/core/src/amazonqTest/chat/controller/controller.ts [109:209]
public constructor(
private readonly chatControllerMessageListeners: TestChatControllerEventEmitters,
messenger: Messenger,
onDidChangeAmazonQVisibility: vscode.Event<boolean>
) {
this.messenger = messenger
this.sessionStorage = ChatSessionManager.Instance
this.authController = new AuthController()
this.editorContentController = new EditorContentController()
this.chatControllerMessageListeners.tabOpened.event((data) => {
return this.tabOpened(data)
})
this.chatControllerMessageListeners.tabClosed.event((data) => {
return this.tabClosed(data)
})
this.chatControllerMessageListeners.authClicked.event((data) => {
this.authClicked(data)
})
this.chatControllerMessageListeners.startTestGen.event(async (data) => {
await this.startTestGen(data, false)
})
this.chatControllerMessageListeners.processHumanChatMessage.event((data) => {
return this.processHumanChatMessage(data)
})
this.chatControllerMessageListeners.formActionClicked.event((data) => {
return this.handleFormActionClicked(data)
})
this.chatControllerMessageListeners.updateTargetFileInfo.event((data) => {
return this.updateTargetFileInfo(data)
})
this.chatControllerMessageListeners.showCodeGenerationResults.event((data) => {
return this.showCodeGenerationResults(data)
})
this.chatControllerMessageListeners.openDiff.event((data) => {
return this.openDiff(data)
})
this.chatControllerMessageListeners.sendUpdatePromptProgress.event((data) => {
return this.handleUpdatePromptProgress(data)
})
this.chatControllerMessageListeners.errorThrown.event((data) => {
return this.handleErrorMessage(data)
})
this.chatControllerMessageListeners.insertCodeAtCursorPosition.event((data) => {
return this.handleInsertCodeAtCursorPosition(data)
})
this.chatControllerMessageListeners.processResponseBodyLinkClick.event((data) => {
return this.processLink(data)
})
this.chatControllerMessageListeners.processChatItemVotedMessage.event((data) => {
this.processChatItemVotedMessage(data).catch((e) => {
getLogger().error('processChatItemVotedMessage failed: %s', (e as Error).message)
})
})
this.chatControllerMessageListeners.processChatItemFeedbackMessage.event((data) => {
this.processChatItemFeedbackMessage(data).catch((e) => {
getLogger().error('processChatItemFeedbackMessage failed: %s', (e as Error).message)
})
})
this.chatControllerMessageListeners.followUpClicked.event((data) => {
switch (data.followUp.type) {
case FollowUpTypes.ViewDiff:
return this.openDiff(data)
case FollowUpTypes.AcceptCode:
return this.acceptCode(data)
case FollowUpTypes.RejectCode:
return this.endSession(data, FollowUpTypes.RejectCode)
case FollowUpTypes.ContinueBuildAndExecute:
return this.handleBuildIteration(data)
case FollowUpTypes.BuildAndExecute:
return this.checkForInstallationDependencies(data)
case FollowUpTypes.ModifyCommands:
return this.modifyBuildCommand(data)
case FollowUpTypes.SkipBuildAndFinish:
return this.endSession(data, FollowUpTypes.SkipBuildAndFinish)
case FollowUpTypes.InstallDependenciesAndContinue:
return this.handleInstallDependencies(data)
case FollowUpTypes.ViewCodeDiffAfterIteration:
return this.openDiff(data)
}
})
AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(() => {
this.sessionStorage.removeActiveTab()
})
}