Skip to content

Commit f6e731f

Browse files
ctiddC Tidd
andauthored
fix(amazonq): Ensure file tree displays all files with correct state after continuing. (#5083)
Co-authored-by: C Tidd <[email protected]>
1 parent a53642e commit f6e731f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ class FeatureDevController(
313313
deletedFiles.find { it.zipFilePath == fileToUpdate }?.let { it.rejected = !it.rejected }
314314
}
315315

316-
// Update the state of the tree view:
316+
// FIXME: This is a kludge that is hiding the fact that insertChanges is updating the file tree above this point to
317+
// an incorrect state. Update the state of the tree view:
317318
messenger.updateFileComponent(message.tabId, filePaths, deletedFiles, messageId)
318319

319320
// Then, if the accepted file is not a deletion, open a diff to show the changes are applied:
@@ -420,9 +421,13 @@ class FeatureDevController(
420421
credentialStartUrl = getStartUrl(project = context.project)
421422
)
422423

424+
// Caution: insertChanges has multiple responsibilities.
425+
// The filter here results in rejected files being hidden from the tree after continuing, by design.
426+
// However, it is critical that we don't hide already-accepted files. Inside insertChanges, it
427+
// filters to only update the subset of passed files that aren't accepted or rejected already.
423428
session.insertChanges(
424-
filePaths = filePaths.filterNot { it.rejected || it.changeApplied },
425-
deletedFiles = deletedFiles.filterNot { it.rejected || it.changeApplied },
429+
filePaths = filePaths.filter { !it.rejected },
430+
deletedFiles = deletedFiles.filter { !it.rejected },
426431
references = references,
427432
messenger
428433
)

plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ amazonqFeatureDev.follow_instructions_for_authentication=Follow instructions to
8282
amazonqFeatureDev.follow_up.close_session=No, thanks
8383
amazonqFeatureDev.follow_up.continue=Continue
8484
amazonqFeatureDev.follow_up.incorrect_source_folder=The folder you chose isn't in your open workspace folder. You can add this folder to your workspace, or choose a folder in your open workspace.
85-
amazonqFeatureDev.follow_up.insert_all_code=Accept all code
86-
amazonqFeatureDev.follow_up.insert_remaining_code=Accept remaining code
85+
amazonqFeatureDev.follow_up.insert_all_code=Accept all changes
86+
amazonqFeatureDev.follow_up.insert_remaining_code=Accept remaining changes
8787
amazonqFeatureDev.follow_up.modified_source_folder=Changed source root to: {0}
8888
amazonqFeatureDev.follow_up.modify_source_folder=Select files for context
8989
amazonqFeatureDev.follow_up.new_task=Yes, I have another task

0 commit comments

Comments
 (0)