馃挰 Comment on multiple lines in a merge request diff
## Problem to solve
Commenting on a single line is great for simple kinds of code review feedback, but frequently a comment is actually addressing multiple lines in the diff, perhaps a portion of a logic block, a paragraph of prose or an entire function. This forces users to chose a single line to provide feedback, but the feedback may in fact be resolved with a change to a different line.
## Further details
Multi-line comments presents a range of challenges that make it difficult to implement in a single iteration. Particularly the complex and substantial changes to the frontend are the primary area of concern.
With the introduction of multi-line comments, reviewers will no longer need to decide which single line of code to choose during a review, instead they will be able to provide feedback to multiple lines in the merge request diff.
## Proposal
It should be possible to create a comment on a merge request diff that spans multiple lines. It should be viewable by others, resolvable and possible to reply to, including:
* internal APIs to provide this functionality to the interface
* public APIs (including) may not be updated in this iteration, as multi line comments will can be treated as single line comments targeting the last line in the range (where they will be displayed in the interface)
### Implementation
| [1. MVC: Drop-down with line range selection](https://gitlab.com/gitlab-org/gitlab/-/issues/211255) | [2. Highlight range selection based on dropdown values](https://gitlab.com/gitlab-org/gitlab/-/issues/14128) | [3. Click and drag cursor to create multi-line merge request comments](https://gitlab.com/gitlab-org/gitlab/-/issues/218319) |
| ------ | ------ | ------ |
|  |  |  |
## Frontend Implementation plan
<details>
<summary>Frontend Implementation plan details</summary>
<pre>
* 1st issue Multi-line comments: **1. MVC Dropdown basic UI on MR comments** https://gitlab.com/gitlab-org/gitlab/-/issues/211255
* Feature flag: multiline_comments, default false.
* 1st MR: Multi-line comments MVC: Add dropdown with full support for inline view https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29516
* Includes MR Reviews support.
* Should we show the first N characters of the line? => If we need BE, create an issue for it.
* Incl https://gitlab.com/gitlab-org/gitlab/-/issues/217690
* 2nd MR: Multi-line comments MVC: Make dropdowns show correct line numbers for parallel view
* 3rd MR: Multi-line comments MVC: Add Docs
* 2nd issue: Multi-line merge request comments: 2. **Highlight lines spanned by each comment** https://gitlab.com/gitlab-org/gitlab/-/issues/14128
* Attention: need to test the themes properly.
* Note: ~~element with pointer-events: none; with rgba()~~ as pointed out by @iamphill, we can leverage the existing `.hll` that highlights a line with full support for all the themes available.
* Note: while leaving the comment, they鈥檒l be highlighted. Clicking/hovering on a comment, highlights too. Blurring the comment, will turn off the highlights.
* Refactors:
* Issue: Rewrite diff lines with `<div>` using table: layout; https://gitlab.com/gitlab-org/gitlab/-/issues/218320
* Is blocking 2nd issue. **Update: Currently being discussed whether it should be a blocker of if we should do the refactor after the feature is developed.**
* Incl: Comment bubble will be shown/hidden via CSS
* Future issue: we can use flexbox/grid
* 3rd issue: Multi-line merge request comments: **3. Add pointer solution for ease-of-use** https://gitlab.com/gitlab-org/gitlab/-/issues/218319
* NOT 13.1, 13.2?...
* Maybe two bubbles? Instead of click and drag?
* 4th issue: Multi-line merge request comments: **4. Update comments on the Overview tab** https://gitlab.com/gitlab-org/gitlab/-/issues/217689
</pre>
</details>
epic