Skip to content

Conversation

@siakmun-aws
Copy link
Contributor

Description

Originally when a file is rejected in /dev and we accepted all other files, VS Code displays the original file trees with the accepted files and rejected files, but JetBrains hides rejected files. This PR aligns JetBrains with VS Code.

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@siakmun-aws siakmun-aws requested a review from a team as a code owner December 5, 2024 18:16
@siakmun-aws siakmun-aws force-pushed the siakmun/rejected-files branch from 8e2db67 to eb85ee8 Compare December 5, 2024 18:17
* Triggered by the Insert code follow-up button to apply code changes.
*/
suspend fun insertChanges(
suspend fun insertChangesAndUpdateFileComponents(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to add comments to make sure I understand the roles of each component.

This is used to

  1. write files to disk and log any references
  2. update the file tree to present visually what has been added or not

Is that right?

}
}

suspend fun insertChangesWithoutUpdateFileComponents(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to add comments to make sure I understand the roles of each component.

This is used to

  1. write files to disk
  2. log any references

Is that right?


if (action == "accept-change") {
session.insertChanges(
session.insertChangesWithoutUpdateFileComponents(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the method name including "WithoutUpdateFileComponents" is an artifact of today's state of code and will not be clear to those reading a future state.

Can we refine this to be more focused on what is actually happening here? Something like writeChangesToDisk?

session.insertChanges(
filePaths = filePaths.filter { !it.rejected },
deletedFiles = deletedFiles.filter { !it.rejected },
session.insertChangesAndUpdateFileComponents(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I recognize that we're trying to maintain the existing logic of both writing to disk and updating the file component because it appears to be appropriate here. Is it cleaner to avoid introducing the "And" method and just perform the individual operations here?

If we do introduce this method, we add a choice to future authors to either update separately or together and I don't think we've sufficiently explained when it should be performed together versus not.

session.writeChangesToDisk(...)
val codeResultMessageId = this._codeResultMessageId
if (codeResultMessageId != null) {
    messenger.updateFileComponent(...)
}

@siakmun-aws
Copy link
Contributor Author

Reply to the above comment about suspend: removing it disrupts the coroutine context handling in the IntelliJ platform's VFS.

@siakmun-aws siakmun-aws force-pushed the siakmun/rejected-files branch from 3828f42 to 8f34394 Compare December 10, 2024 20:01
@siakmun-aws siakmun-aws merged commit aa50626 into aws:main Dec 11, 2024
11 checks passed
laileni-aws pushed a commit to laileni-aws/aws-toolkit-jetbrains that referenced this pull request Dec 12, 2024
aws#5169)

* Fix rejected files display inconsistency between VS Code and JetBrains

* Refactor

* Refactor

* Refactor

* Clean

* Clean

* Changed from `when` to whenever

* Fixing detekt

* Fixing detekt

* Fixing detekt

---------

Co-authored-by: Richard Li <[email protected]>
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 17, 2025
aws#5169)

* Fix rejected files display inconsistency between VS Code and JetBrains

* Refactor

* Refactor

* Refactor

* Clean

* Clean

* Changed from `when` to whenever

* Fixing detekt

* Fixing detekt

* Fixing detekt

---------

Co-authored-by: Richard Li <[email protected]>
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 22, 2025
aws#5169)

* Fix rejected files display inconsistency between VS Code and JetBrains

* Refactor

* Refactor

* Refactor

* Clean

* Clean

* Changed from `when` to whenever

* Fixing detekt

* Fixing detekt

* Fixing detekt

---------

Co-authored-by: Richard Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants