Skip to content

Commit f268b5f

Browse files
committed
removed redudnant check for one or multiple diffs when accepting changes
1 parent aadcc58 commit f268b5f

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const patchDescriptions: { [key: string]: string } = {
3636
'Miscellaneous Processing Documentation upgrade':
3737
'This diff patch covers a diverse set of upgrades spanning ORMs, XML processing, API documentation, and more.',
3838
'Upgrade Deprecated API': '',
39+
'Updated dependencies to latest version': '',
3940
}
4041

4142
export const JsonConfigFileNamingConvention = new Set([

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

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import { parsePatch, applyPatches, ParsedDiff } from 'diff'
1010
import path from 'path'
1111
import vscode from 'vscode'
1212
import { ExportIntent } from '@amzn/codewhisperer-streaming'
13-
import { TransformByQReviewStatus, transformByQState, PatchInfo, DescriptionContent } from '../../models/model'
13+
import {
14+
TransformByQReviewStatus,
15+
transformByQState,
16+
PatchInfo,
17+
DescriptionContent,
18+
TransformationType,
19+
} from '../../models/model'
1420
import { ExportResultArchiveStructure, downloadExportResultArchive } from '../../../shared/utilities/download'
1521
import { getLogger } from '../../../shared/logger'
1622
import { telemetry } from '../../../shared/telemetry/telemetry'
@@ -538,38 +544,30 @@ export class ProposedTransformationExplorer {
538544
}
539545

540546
//We do this to ensure that the changesAppliedChatMessage is only sent to user when they accept the first diff.patch
541-
if (transformByQState.getMultipleDiffs()) {
542-
if (diffModel.currentPatchIndex === patchFiles.length - 1) {
543-
transformByQState.getChatControllers()?.transformationFinished.fire({
544-
message: CodeWhispererConstants.changesAppliedChatMessageMultipleDiffs(
545-
diffModel.currentPatchIndex,
546-
patchFiles.length,
547-
patchFilesDescriptions
548-
? patchFilesDescriptions.content[diffModel.currentPatchIndex].name
549-
: undefined
550-
),
551-
tabID: ChatSessionManager.Instance.getSession().tabID,
552-
includeStartNewTransformationButton: true,
553-
})
554-
} else {
555-
transformByQState.getChatControllers()?.transformationFinished.fire({
556-
message: CodeWhispererConstants.changesAppliedChatMessageMultipleDiffs(
557-
diffModel.currentPatchIndex,
558-
patchFiles.length,
559-
patchFilesDescriptions
560-
? patchFilesDescriptions.content[diffModel.currentPatchIndex].name
561-
: undefined
562-
),
563-
tabID: ChatSessionManager.Instance.getSession().tabID,
564-
includeStartNewTransformationButton: false,
565-
})
566-
}
567-
} else {
547+
if (diffModel.currentPatchIndex === patchFiles.length - 1) {
568548
transformByQState.getChatControllers()?.transformationFinished.fire({
569-
message: CodeWhispererConstants.changesAppliedChatMessageOneDiff,
549+
message: CodeWhispererConstants.changesAppliedChatMessageMultipleDiffs(
550+
diffModel.currentPatchIndex,
551+
patchFiles.length,
552+
patchFilesDescriptions
553+
? patchFilesDescriptions.content[diffModel.currentPatchIndex].name
554+
: undefined
555+
),
570556
tabID: ChatSessionManager.Instance.getSession().tabID,
571557
includeStartNewTransformationButton: true,
572558
})
559+
} else {
560+
transformByQState.getChatControllers()?.transformationFinished.fire({
561+
message: CodeWhispererConstants.changesAppliedChatMessageMultipleDiffs(
562+
diffModel.currentPatchIndex,
563+
patchFiles.length,
564+
patchFilesDescriptions
565+
? patchFilesDescriptions.content[diffModel.currentPatchIndex].name
566+
: undefined
567+
),
568+
tabID: ChatSessionManager.Instance.getSession().tabID,
569+
includeStartNewTransformationButton: false,
570+
})
573571
}
574572

575573
// Load the next patch file

0 commit comments

Comments
 (0)