[WIP] Update collapseAll behavior for newly created 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
getCommentCollapsibleStatefunction insrc/github/utils.tsdetermines whether a comment thread should be expanded or collapsed - Currently,
collapseAllsetting 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
collapsePreExistingthat collapses only pre-existing comments - [ ] Update
getCommentCollapsibleStateto 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
updateThreadandupdateThreadWithRangeto 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- UpdategetCommentCollapsibleStatelogic -
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 thecollapseAllmode so that comments you just created do not automatically collapse.I my opinion,
collapseAllshould 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.