gh.nvim icon indicating copy to clipboard operation
gh.nvim copied to clipboard

Support requesting code suggestions

Open rlch opened this issue 3 years ago • 8 comments

Hey!

First of all, loving the look of this plugin - I'm actively watching its development. Haven't used it yet as I'll be waiting for the all commits flag; which is more inline with my workflow.

I was wondering if you support / have plans on supporting requesting code suggestions? One of the biggest frustration points for me when reviewing PR's is not having LSP + treesitter support in the GitHub UI, resulting in requested changes with typo's + indentation issues etc. Would love to get your thoughts on this!

Thanks :)

rlch avatar May 12 '22 04:05 rlch

Hey,

What do you mean by "request code changes" ?

ldelossa avatar May 12 '22 10:05 ldelossa

image

image

Sorry @ldelossa, should've clarified. It's actually called a suggestion

rlch avatar May 12 '22 10:05 rlch

Yes! Definitely on the list. Do you have any initial ideas on how this should work?

ldelossa avatar May 12 '22 11:05 ldelossa

First of all, loving the look of this plugin - I'm actively watching its development. Haven't used it yet as I'll be waiting for the all commits flag; which is more inline with my workflow.

By this do you mean you're waiting for a tree which shows "all modified files" ?

ldelossa avatar May 12 '22 11:05 ldelossa

As for the server-side, I don't really know -- not too familiar with the GQL API and I'm assuming you can't use the REST API to submit suggestions. Seems like UserContentEdit is the relevant object for suggestions? If I get some time I'll do some proper digging

Ideally TS + LSP would be supported, and we could perhaps use signs, folds, or something that conceals/indicates unmodifiable lines outside the comment range. If you don't already support comment ranges, could be nice to use visual-mode for this.

Once the comment is submitted, I think it'd be nice to see the diff between their code and the edit like in GH; could borrow some code from diffview or fugitive or something for this.

Not sure what the best UX is for how suggestions should be saved; I would think the user could toggle between allowing edits to save (so the reviewer can run tests on their suggestion etc), or ignoring the changes - as I typically have the assignee clean up any side-effects caused by an API change for example. Could also keep both and hotswap between for certain flows; if you're looking at the diffview I would expect to see the original diff and not the new one caused by my edit.

I would love to help out on this, hoping I get some time soon to give it a look.

rlch avatar May 12 '22 12:05 rlch

First of all, loving the look of this plugin - I'm actively watching its development. Haven't used it yet as I'll be waiting for the all commits flag; which is more inline with my workflow.

By this do you mean you're waiting for a tree which shows "all modified files" ?

Yep. In fact, my workflow is a bit of a mix of the two depending on the context/size of the PR. So ideally it's not just a flag, I can select whether to review all modified files or each commit through the UI

rlch avatar May 12 '22 12:05 rlch

Cool suggestions! Let me look into a few things. I need to do a couple other PRs until we get to suggestions (like aggregate file view we mentioned above). I also need to brush up on TS. I dont really know if I can apply TS highlighting to a chunk of arbitrary text inside a buffer? I think I see nvim-notify doing this, but not sure how yet.

In a perfect world, any code blocks in the covo buffer of a threaded message get a nice syntax aware highlighting. And yes, morphing "suggestion" markdown blocks into inline diffs would be pretty sick.

ldelossa avatar May 12 '22 15:05 ldelossa

For posting code suggestions, my workflow currently is to open the change that I want to comment on, yank the relevant lines, open a comment thread, then manually type ```suggestion, newline, paste, edit , type the ``` to close out the diff, and post the comment.

It would be neat to have something a bit more integrated like if you edit/delete some lines in the file buffer then open a comment thread, the buffer automatically opens with a ```suggestion ... ``` comment pre-populated.

Extra points would be the inverse workflow - when reading reviews from peers, ability to integrate the suggestions directly back into the local files. I don't know quite how that would look though.

joestringer avatar Jul 09 '24 23:07 joestringer