GitHub multiline suggestion with expanded context

93 Views Asked by At

It's possible to add a multiline code suggestion to a PR like this, which is a really nice feature:

You can now suggest a specific change to multiple lines of code when reviewing a pull request. To select a multi-line code block, you can either:

  • click and hold to the right of a line number, drag and then release the mouse when you’ve reached the last line of the desired selection; or
  • click on a line number, hold Shift, click on a second line numberv and click the "+" button to the right of the second line number. Once you've selected the code block, click the diff icon and edit the text within the suggestion block.

But unfortunately this only works for selecting lines which are within the default context, which is shown in the PR.

I'd like to suggest a change which begins some lines before the default diff context. When looking at the diff I can easily click the "expand up" button (the little arrow) so that I can see an expanded diff.

expand diff

But I cannot "start" a suggestion in this expanded diff... Trying to start the suggestion within the expanded white/non-yellow lines won't work. If I try to do this anyway, only a one-line suggestion is accepted.

Does anyone know how to accomplish this? Or is this just impossible?

0

There are 0 best solutions below