Implement line expansion

Problem

We need to have a unified diff line expansion backend API for commit, MR and compare revisions views. Right now the UI and logic for diff line expansion is different between these pages. We need to decide on what the final UI and API should look like and implement it.

Currently, both commit and MR diffs are using Projects::BlobController#diff endpoint. The difference is that we render response in JSON for MRs (when from_merge_request param is set) and render app/views/projects/blob/diff.html.haml for commit.

Solution

We should properly implement line expansion that should work across all pages. Ideally we'd always use the same ViewComponent for all 3 endpoints. The component was implemented as a part of Add ViewComponents for diff file viewers (#460257 - closed). The lines and matching_line (if necessary) would have to be explicitly passed to the ViewComponent.

The new endpoint path will be /-/blob/:id/diff_lines / Projects::BlobController#diff_lines

Code references

Existing code could be refactored to achieve that after new diff file viewers broke it.

Edited by Paulina Sedlak-Jakubowska