Skip to content

Commit 4875b2b

Browse files
committed
addressing minor comments and fixing chat messaging
1 parent e420a97 commit 4875b2b

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

packages/amazonq/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,6 @@
10951095
},
10961096
"engines": {
10971097
"npm": "^10.1.0",
1098-
"vscode": "^1.68.0"
1098+
"vscode": "^1.83.0"
10991099
}
11001100
}

packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ export class Messenger {
224224
options: [
225225
{
226226
value: JDKVersion.JDK8,
227-
label: JDKVersion.JDK8.toString(),
227+
label: JDKVersion.JDK8,
228228
},
229229
{
230230
value: JDKVersion.JDK11,
231-
label: JDKVersion.JDK11.toString(),
231+
label: JDKVersion.JDK11,
232232
},
233233
{
234234
value: JDKVersion.UNSUPPORTED,

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ export const jobStartedChatMessage =
468468
'I am starting to transform your code. It can take 10 to 30 minutes to upgrade your code, depending on the size of your project. To monitor progress, go to the Transformation Hub. If I run into any issues, I might pause the transformation to get input from you on how to proceed.'
469469

470470
export const userPatchDescriptionChatMessage = `
471-
I can now divide the transformation results into diff patches if you would like to review and accept each diff with fewer changes:
471+
I can now divide the transformation results into diff patches (if applicable to the app) if you would like to review and accept each diff with fewer changes:
472472
473473
• Minimal Compatible Library Upgrade to Java 17: Dependencies to the minimum compatible versions in Java 17, including Springboot, JUnit, and PowerMockito.
474474

packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -169,42 +169,34 @@ export class DiffModel {
169169
diffDescription: PatchInfo | undefined,
170170
totalDiffPatches: number
171171
): PatchFileNode {
172-
console.log('parsing ', pathToDiff)
173172
this.patchFileNodes = []
174173
const diffContents = fs.readFileSync(pathToDiff, 'utf8')
175-
console.log('diff contents: ', diffContents)
176174
const changedFiles = parsePatch(diffContents)
177-
console.log('changed files: ', changedFiles)
178175
// path to the directory containing copy of the changed files in the transformed project
179176
const pathToTmpSrcDir = this.copyProject(pathToWorkspace, changedFiles)
180177
transformByQState.setProjectCopyFilePath(pathToTmpSrcDir)
181-
console.log('path to tmp src dir: ', pathToTmpSrcDir)
182178

183179
applyPatches(changedFiles, {
184180
loadFile: function (fileObj, callback) {
185181
// load original contents of file
186182
const filePath = path.join(pathToWorkspace, fileObj.oldFileName!.substring(2))
187-
console.log(`loading filePath ${filePath}, exists = ${fs.existsSync(filePath)}`)
188183
if (!fs.existsSync(filePath)) {
189184
// must be a new file (ex. summary.md), so pass empty string as original contents and do not pass error
190185
callback(undefined, '')
191186
} else {
192187
// must be a modified file (most common), so pass original contents
193188
const fileContents = fs.readFileSync(filePath, 'utf-8')
194-
console.log('original contents = ', fileContents)
195189
callback(undefined, fileContents)
196190
}
197191
},
198192
// by now, 'content' contains the changes from the patch
199193
patched: function (fileObj, content, callback) {
200194
const filePath = path.join(pathToTmpSrcDir, fileObj.newFileName!.substring(2))
201-
console.log(`about to write ${content} to ${filePath}`)
202195
// write changed contents to the copy of the original file (or create a new file)
203196
fs.writeFileSync(filePath, content)
204197
callback(undefined)
205198
},
206199
complete: function (err) {
207-
console.log(`error = ${err}`)
208200
if (err) {
209201
getLogger().error(`CodeTransformation: ${err} when applying patch`)
210202
} else {
@@ -438,17 +430,26 @@ export class ProposedTransformationExplorer {
438430
pathContainingArchive = path.dirname(pathToArchive)
439431
const zip = new AdmZip(pathToArchive)
440432
zip.extractAllTo(pathContainingArchive)
441-
console.log('pathContainingArchive = ', pathContainingArchive)
442433
const files = fs.readdirSync(path.join(pathContainingArchive, ExportResultArchiveStructure.PathToPatch))
443-
files.forEach((file) => {
444-
const filePath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToPatch, file)
445-
if (file === 'diff.patch') {
446-
singlePatchFile = filePath
447-
} else if (file.endsWith('.json')) {
448-
const jsonData = fs.readFileSync(filePath, 'utf-8')
449-
patchFilesDescriptions = JSON.parse(jsonData)
434+
if (files.length === 1) {
435+
singlePatchFile = path.join(
436+
pathContainingArchive,
437+
ExportResultArchiveStructure.PathToPatch,
438+
files[0]
439+
)
440+
} else {
441+
const jsonFile = files.find((file) => file.endsWith('.json'))
442+
if (!jsonFile) {
443+
throw new Error('Expected JSON file not found')
450444
}
451-
})
445+
const filePath = path.join(
446+
pathContainingArchive,
447+
ExportResultArchiveStructure.PathToPatch,
448+
jsonFile
449+
)
450+
const jsonData = fs.readFileSync(filePath, 'utf-8')
451+
patchFilesDescriptions = JSON.parse(jsonData)
452+
}
452453
if (patchFilesDescriptions !== undefined) {
453454
for (const patchInfo of patchFilesDescriptions.content) {
454455
patchFiles.push(
@@ -488,7 +489,6 @@ export class ProposedTransformationExplorer {
488489
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
489490
} catch (e: any) {
490491
deserializeErrorMessage = (e as Error).message
491-
console.log('error parsing diff ', deserializeErrorMessage)
492492
getLogger().error(`CodeTransformation: ParseDiff error = ${deserializeErrorMessage}`)
493493
transformByQState.getChatControllers()?.transformationFinished.fire({
494494
message: `${CodeWhispererConstants.errorDeserializingDiffChatMessage} ${deserializeErrorMessage}`,

0 commit comments

Comments
 (0)