Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbench.action.submitComment not functional when first replying to a comment thread & confusing when editing comments #151739

Closed
hermannloose opened this issue Jun 10, 2022 · 6 comments · Fixed by #152464
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug comments Comments Provider/Widget/Panel issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@hermannloose
Copy link
Contributor

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.66-0
  • OS Version: web

Steps to Reproduce:

  1. Create a CommentThread with CommentThread.canReply = true (the default) and some existing Comments in CommentThread.comments that have Comment.mode = CommentMode.Preview (i.e. published comments by code reviewers; please let us know in case we hold this API completely wrong though ...).
  2. Observe the CommentThreadWidget rendering a "Reply ..." button.
  3. Click the "Reply ..." button to open the reply editor. Type some content.
  4. Press Ctrl+Enter / Cmd+Enter (the default keyboard shortcut) to trigger a workbench.action.submitComments.

Expected Result:

  • This runs an action contributed to comments/commentThread/context, as these are the actions visible under the reply editor at this point.

Observed Result:

  • CommentThread.submitComment() sees this._body.activeComment as undefined and does not run anything.

    activeComment is the first CommentNode where CommentNode.editing is true. This is set by CommentNode.switchToEditNode(), i.e. when setting Comment.mode = CommentMode.Editing from the extension. However, the extension cannot selectively create such a comment in response to the user clicking "Reply ...", it could only do so for all visible comments preemptively, which would lead to bad UX.

  • Another very surprising (buggy?) side effect of this: while actually editing such an existing comment, Ctrl+Enter / Cmd+Enter does trigger a command, however it's the first command registered for comments/commentThread/context, all of which are not visible as buttons at that point in time. The expected result here would be that it would run an action from comments/comment/context, i.e. related to the individual Comment, not the CommentThread.

@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.68.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@hermannloose
Copy link
Contributor Author

tl;dr: Ctrl+Enter should have predictable functionality for users and extension developers.

This would be achieved if:

  • Ctrl+Enter while creating a comment (through "Reply ...") would trigger an action from comments/commentThread/context
  • Ctrl+Enter while editing a comment would trigger an action from comments/comment/context

@rebornix rebornix assigned alexr00 and unassigned rebornix Jun 10, 2022
@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug comments Comments Provider/Widget/Panel issues labels Jun 13, 2022
@alexr00 alexr00 added this to the June 2022 milestone Jun 13, 2022
alexr00 added a commit that referenced this issue Jun 17, 2022
@alexr00
Copy link
Member

alexr00 commented Jun 17, 2022

Thank you for providing so many details!

alexr00 added a commit that referenced this issue Jun 17, 2022
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jun 17, 2022
@connor4312 connor4312 added the author-verification-requested Issues potentially verifiable by issue author label Jun 30, 2022
@VSCodeTriageBot
Copy link
Collaborator

This bug has been fixed in the latest release of VS Code Insiders!

@hermannloose, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version f1abeea of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

@alexr00
Copy link
Member

alexr00 commented Jul 1, 2022

To verify:

  1. Open a folder with a GitHub repository.
  2. Install the pre-release version of GitHub Pull Requests and Issues extension.
  3. Open a file that's part of a PR with the extension.
  4. Make a comment in the file.
  5. Use the "Reply" box on your comment to start making a reply. Verify that when you press ctrl+enter it will submit the comment.
  6. Start to edit one of your comments. Verify that when you press ctrl+enter it will submit your edit.

@TylerLeonhardt TylerLeonhardt added verified Verification succeeded and removed author-verification-requested Issues potentially verifiable by issue author labels Jul 1, 2022
@hermannloose
Copy link
Contributor Author

Sorry for not verifying this earlier. In my test extension for Insiders it seems to work, contributed commands are picked from the correct menus and appear to honor when clauses.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug comments Comments Provider/Widget/Panel issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants