feat(gh): add action to edit your own inline review comments - #2959
Open
ccarvalho-eng wants to merge 1 commit into
Open
ccarvalho-eng wants to merge 1 commit into
ccarvalho-eng wants to merge 1 commit into
Conversation
Adds gh_edit_comment, enabled when the cursor is on a comment you
authored (viewerDidAuthor). Reuses the existing scratch-buffer edit
flow, prefilled with the comment's current body, and PATCHes
/repos/{repo}/pulls/comments/{id} on submit.
comment_id (used by gh_reply_to_comment) always resolves to a
thread's root comment, since GitHub's reply endpoint requires
anchoring to the root. Editing needs the exact comment under the
cursor instead, so this adds a separate edit_comment_id tag that
covers only that comment's own lines, not lines belonging to nested
replies rendered beneath it.
viewerDidAuthor wasn't previously fetched for individual review
comments (only at the review level), so the GraphQL query for inline
comments now requests it too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's currently no way to edit an inline PR review comment from the picker — only to add one (
gh_diff_comment) or reply (gh_reply_to_comment). This addsgh_edit_comment, enabled only when the cursor sits on a comment you authored (viewerDidAuthor).viewerDidAuthorwasn't previously requested for individual review comments in the GraphQL query (only at the review level), so this adds it there too.A subtlety worth flagging for review:
comment_id(used bygh_reply_to_comment) always resolves to a thread's root comment, because GitHub's reply endpoint requires anchoring to the root regardless of which reply you're looking at. Editing needs the exact comment under the cursor, not the thread root, so this adds a separateedit_comment_idtag in the renderer that covers only that comment's own lines (header + body), not the lines belonging to any nested replies rendered beneath it.The edit itself reuses the existing scratch-buffer edit flow (
edit = "body-file"), prefilled with the comment's current body, and submits aPATCH /repos/{owner}/{repo}/pulls/comments/{id}with the new body.