vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

[WIP] Update collapseAll behavior for newly created comments

Open Copilot opened this issue 2 months ago • 0 comments

Plan to Fix Comment Auto-Collapse Issue

The issue is that when commentExpandState is set to collapseAll, even newly created comments immediately collapse, which is annoying for users who want to review what they just wrote.

Analysis

  • The getCommentCollapsibleState function in src/github/utils.ts determines whether a comment thread should be expanded or collapsed
  • Currently, collapseAll setting collapses ALL comments including newly created ones
  • Need to track which comments were just created in the current session and keep them expanded

Proposed Solution

  • [ ] Add a new setting value collapsePreExisting that collapses only pre-existing comments
  • [ ] Update getCommentCollapsibleState to accept a parameter indicating if the comment was just created
  • [ ] Track newly created comment threads to keep them expanded initially
  • [ ] Update package.json to add the new setting option
  • [ ] Update package.nls.json with localized strings for the new option
  • [ ] Update the logic in updateThread and updateThreadWithRange to pass the "just created" flag
  • [ ] Test the changes to ensure newly created comments stay expanded while others collapse

Files to Modify

  • package.json - Add new enum value for setting
  • package.nls.json - Add localized description for new setting
  • src/github/utils.ts - Update getCommentCollapsibleState logic
  • src/view/reviewCommentController.ts - Track newly created threads
  • src/view/pullRequestCommentController.ts - Track newly created threads
Original prompt

This section details on the original issue you should resolve

<issue_title>Please do not automatically collapse the comment I just created when using collapseAll</issue_title> <issue_description>This is a feature request to change the behaviour of the collapseAll mode so that comments you just created do not automatically collapse.

I my opinion, collapseAll should only apply to pre-existing comments. When I post a comment I find it quite annoying that it immediately disappears, as often I want to re-read what I wrote to check the markdown rendered properly and I didn't make any mistakes or was not as clear as I could be.

Perhaps there could be a new value for the setting, called collapsePreExisting?

https://github.com/user-attachments/assets/2ba2ef64-ea79-41fb-a23c-0eddd008297b

I have

"githubPullRequests.commentExpandState": "collapseAll",

but would not expect a comment I just made to automatically collapse

Originally posted by @MetRonnie in #3345. The current behaviour is considered correct according to https://github.com/microsoft/vscode-pull-request-github/issues/3345#issuecomment-2511781215


</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes microsoft/vscode-pull-request-github#6503

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Dec 10 '25 11:12 Copilot