Show function signature in diffs
Description
When reviewing code for a MR (but also in diffs in general in GitLab), often large portions of the code is compaced with ... which you must click on to expand. This current functionality is fine except for the fact that often hidden in these ...'s are the function signature definitions. These are usually displayed in a typical "git diff" command to provide context to the user as to what function they are looking at, and without the function signature it is difficult to tell what function you are in, and what code is associated with what code by such a function as well. Likewise, the ...'s can be difficult to notice sometimes and it can seem as though you are looking at one function's code when in fact you are looking at two. Trying to tell what function the code you are looking at requires clicking sometimes numerous cascaded ...'s in order to find the function signature definition, and if one is missed can lead to a misleading idea of what you are looking at. (yes, in a perfect world all our functions would be small and we would probably never see the definitions collapsed, but so much for a perfect world)
The goal of this proposal is to simplify this problem by always displaying the function signature or having it be an optional setting in user preferences if it is deemed not useful to all. This is something which git diff does automatically as it stands, and for good reason, so you can relate changes to what function they are occurring in.
Proposal
Always show the function signature declaration, never collapsing it, when displaying a diff in Gitlab. This or optionally have a setting in preferences to accomplish this.
Overview
What is it? Showing function signature definitions in diffs
Why should someone use this feature? Because it can be confusing and annoying to find/click ...'s
What is the underlying (business) problem? Gitlab collapses most non-diff code, including function signatures.
How do you use this feature? For reviewing code mostly.
Use cases
Who is this for? Provide one or more use cases.
This is for developers/managers, anyone who reviews code.
Example of current way diff is done. Apologies for redacts, what is being done is unimportant so much as it is unclear what function you are viewing. Since there are two sets of ...'s in this view, you must potentially open both to see what each of the code blocks belongs to (functions of their own, or the same function?)
Example of those ...'s expanded. As you can see I had to open the lower one, find out that the two parts of code are together, and then had to go open up the upper one to see finally what the function was called (line 185, moveSomething async function...) What I would propose is that line 185 always be displayed as it is the function signature for the code we are looking at, while leaving all else that is normally collapsed into ...'s collapsed so it doesn't get in the way, optionally clickable as it currently is to open it further.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml