Skip to content
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
30 changes: 19 additions & 11 deletions packages/core/src/codewhisperer/commands/startTransformByQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,15 @@ export async function postTransformationJob() {

let chatMessage = transformByQState.getJobFailureErrorChatMessage()
if (transformByQState.isSucceeded()) {
chatMessage = CodeWhispererConstants.jobCompletedChatMessage(transformByQState.getTargetJDKVersion() ?? '')
chatMessage = CodeWhispererConstants.jobCompletedChatMessage
} else if (transformByQState.isPartiallySucceeded()) {
chatMessage = CodeWhispererConstants.jobPartiallyCompletedChatMessage
}

if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
chatMessage += CodeWhispererConstants.upgradeLibrariesMessage
}

transformByQState.getChatControllers()?.transformationFinished.fire({
message: chatMessage,
tabID: ChatSessionManager.Instance.getSession().tabID,
Expand All @@ -707,19 +711,23 @@ export async function postTransformationJob() {
})
}

let notificationMessage = ''

if (transformByQState.isSucceeded()) {
void vscode.window.showInformationMessage(
CodeWhispererConstants.jobCompletedNotification(transformByQState.getTargetJDKVersion() ?? ''),
{
title: localizedText.ok,
}
)
notificationMessage = CodeWhispererConstants.jobCompletedNotification
if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
notificationMessage += CodeWhispererConstants.upgradeLibrariesMessage
}
void vscode.window.showInformationMessage(notificationMessage, {
title: localizedText.ok,
})
} else if (transformByQState.isPartiallySucceeded()) {
notificationMessage = CodeWhispererConstants.jobPartiallyCompletedNotification
if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
notificationMessage += CodeWhispererConstants.upgradeLibrariesMessage
}
void vscode.window
.showInformationMessage(
CodeWhispererConstants.jobPartiallyCompletedNotification,
CodeWhispererConstants.amazonQFeedbackText
)
.showInformationMessage(notificationMessage, CodeWhispererConstants.amazonQFeedbackText)
.then((choice) => {
if (choice === CodeWhispererConstants.amazonQFeedbackText) {
void submitFeedback(
Expand Down
17 changes: 10 additions & 7 deletions packages/core/src/codewhisperer/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,18 @@ export const enterJavaHomePlaceholder = 'Enter the path to your Java installatio

export const openNewTabPlaceholder = 'Open a new tab to chat with Q'

export const jobCompletedChatMessage = (version: string) =>
`I completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I'm proposing. If you want to upgrade additional libraries and other dependencies, run /transform with the transformed code and specify ${version} as the source and target version.`
export const jobCompletedChatMessage =
'I completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I am proposing. '

export const jobCompletedNotification = (version: string) =>
`Amazon Q transformed your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes. If you want to upgrade additional libraries and other dependencies, run /transform with the transformed code and specify ${version} as the source and target version.`
export const jobCompletedNotification =
'Amazon Q transformed your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes. '

export const jobPartiallyCompletedChatMessage = `I transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.`
export const upgradeLibrariesMessage =
'After successfully building in Java 17 or 21, an additional transformation is required to upgrade your libraries and dependencies. Choose the same source code version and target code version (for example, 17 to 17) to do this.'

export const jobPartiallyCompletedNotification = `Amazon Q transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.`
export const jobPartiallyCompletedChatMessage = `I transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation. `

export const jobPartiallyCompletedNotification = `Amazon Q transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation. `

export const noPomXmlFoundChatMessage = `I couldn\'t find a project that I can upgrade. I couldn\'t find a pom.xml file in any of your open projects, nor could I find any embedded SQL statements. Currently, I can upgrade Java 8, 11, or 17 projects built on Maven, or Oracle SQL to PostgreSQL statements in Java projects. For more information, see the [Amazon Q documentation](${codeTransformPrereqDoc}).`

Expand Down Expand Up @@ -730,7 +733,7 @@ export const cleanInstallErrorNotification = `Amazon Q could not run the Maven c
export const enterJavaHomeChatMessage = 'Enter the path to JDK'

export const projectPromptChatMessage =
'I can upgrade your Java project. To start the transformation, I need some information from you. Choose the project you want to upgrade and the target code version to upgrade to. Then, choose Confirm.'
'I can upgrade your Java project. To start the transformation, I need some information from you. Choose the project you want to upgrade and the target code version to upgrade to. Then, choose Confirm.\n\nAfter successfully building in Java 17 or 21, an additional transformation is required to upgrade your libraries and dependencies. Choose the same source code version and target code version (for example, 17 to 17) to do this.'

export const windowsJavaHomeHelpChatMessage =
'To find the JDK path, run the following commands in a new terminal: `cd "C:/Program Files/Java"` and then `dir`. If you see your JDK version, run `cd <version>` and then `cd` to show the path.'
Expand Down
Loading