Skip to content

Commit e63ab97

Browse files
committed
addressing minor comments and fixing chat messaging
1 parent c509beb commit e63ab97

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
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
@@ -472,7 +472,7 @@ export const chooseTransformationObjective = `I can help you with the following
472472
export const chooseTransformationObjectivePlaceholder = 'Enter "language upgrade" or "sql conversion"'
473473

474474
export const userPatchDescriptionChatMessage = `
475-
I can now divide the transformation results into diff patches if you would like to review and accept each diff with fewer changes:
475+
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:
476476
477477
• Minimal Compatible Library Upgrade to Java 17: Dependencies to the minimum compatible versions in Java 17, including Springboot, JUnit, and PowerMockito.
478478

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ 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')
175174

@@ -179,37 +178,31 @@ export class DiffModel {
179178
}
180179

181180
const changedFiles = parsePatch(diffContents)
182-
console.log('changed files: ', changedFiles)
183181
// path to the directory containing copy of the changed files in the transformed project
184182
const pathToTmpSrcDir = this.copyProject(pathToWorkspace, changedFiles)
185183
transformByQState.setProjectCopyFilePath(pathToTmpSrcDir)
186-
console.log('path to tmp src dir: ', pathToTmpSrcDir)
187184

188185
applyPatches(changedFiles, {
189186
loadFile: function (fileObj, callback) {
190187
// load original contents of file
191188
const filePath = path.join(pathToWorkspace, fileObj.oldFileName!.substring(2))
192-
console.log(`loading filePath ${filePath}, exists = ${fs.existsSync(filePath)}`)
193189
if (!fs.existsSync(filePath)) {
194190
// must be a new file (ex. summary.md), so pass empty string as original contents and do not pass error
195191
callback(undefined, '')
196192
} else {
197193
// must be a modified file (most common), so pass original contents
198194
const fileContents = fs.readFileSync(filePath, 'utf-8')
199-
console.log('original contents = ', fileContents)
200195
callback(undefined, fileContents)
201196
}
202197
},
203198
// by now, 'content' contains the changes from the patch
204199
patched: function (fileObj, content, callback) {
205200
const filePath = path.join(pathToTmpSrcDir, fileObj.newFileName!.substring(2))
206-
console.log(`about to write ${content} to ${filePath}`)
207201
// write changed contents to the copy of the original file (or create a new file)
208202
fs.writeFileSync(filePath, content)
209203
callback(undefined)
210204
},
211205
complete: function (err) {
212-
console.log(`error = ${err}`)
213206
if (err) {
214207
getLogger().error(`CodeTransformation: ${err} when applying patch`)
215208
} else {
@@ -443,17 +436,26 @@ export class ProposedTransformationExplorer {
443436
pathContainingArchive = path.dirname(pathToArchive)
444437
const zip = new AdmZip(pathToArchive)
445438
zip.extractAllTo(pathContainingArchive)
446-
console.log('pathContainingArchive = ', pathContainingArchive)
447439
const files = fs.readdirSync(path.join(pathContainingArchive, ExportResultArchiveStructure.PathToPatch))
448-
files.forEach((file) => {
449-
const filePath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToPatch, file)
450-
if (file === 'diff.patch') {
451-
singlePatchFile = filePath
452-
} else if (file.endsWith('.json')) {
453-
const jsonData = fs.readFileSync(filePath, 'utf-8')
454-
patchFilesDescriptions = JSON.parse(jsonData)
440+
if (files.length === 1) {
441+
singlePatchFile = path.join(
442+
pathContainingArchive,
443+
ExportResultArchiveStructure.PathToPatch,
444+
files[0]
445+
)
446+
} else {
447+
const jsonFile = files.find((file) => file.endsWith('.json'))
448+
if (!jsonFile) {
449+
throw new Error('Expected JSON file not found')
455450
}
456-
})
451+
const filePath = path.join(
452+
pathContainingArchive,
453+
ExportResultArchiveStructure.PathToPatch,
454+
jsonFile
455+
)
456+
const jsonData = fs.readFileSync(filePath, 'utf-8')
457+
patchFilesDescriptions = JSON.parse(jsonData)
458+
}
457459
if (patchFilesDescriptions !== undefined) {
458460
for (const patchInfo of patchFilesDescriptions.content) {
459461
patchFiles.push(
@@ -493,7 +495,6 @@ export class ProposedTransformationExplorer {
493495
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
494496
} catch (e: any) {
495497
deserializeErrorMessage = (e as Error).message
496-
console.log('error parsing diff ', deserializeErrorMessage)
497498
getLogger().error(`CodeTransformation: ParseDiff error = ${deserializeErrorMessage}`)
498499
transformByQState.getChatControllers()?.transformationFinished.fire({
499500
message: `${CodeWhispererConstants.errorDeserializingDiffChatMessage} ${deserializeErrorMessage}`,

0 commit comments

Comments
 (0)