Jump to definition when viewing a diff
Problem to solve
When viewing a diff on GitLab (compare interface or merge requests) and I see a function, I don't know what it does if it is defined in another file. This means I need to go the file where it is defined, but I might not even know where it is defined, particularly if it is not part of the code I am familiar with. To work around this today I need to checkout the code and install the dev tools to get proper code nav in my local IDE.
If LSIF files are uploaded to GitLab, we can use this information when browsing a repository to show code nav information.
When viewing a diff, and an LSIF file has been uploaded for the source branch/SHA in the comparison,
- show function definitions on hover over lines in the source branch/SHA
- provide Jump to definition
Only requesting code nav for the source branch/SHA means that lines on the old side of the diff will not have code nav.
Availability & Testing
Risks to availability should be minimal because the feature is an addition to existing functionality. There is potential for disruption, for example, if performance of the feature depends on the size of the diff.
We should include large diffs in tests of the performance of loading diffs when this feature is enabled, and of the performance of the feature itself.
If LSIF files can include arbitrary content, we should ensure that they can't be abused as an XSS exploit when definitions are displayed.
Unit/integration tests (and feature tests if necessary) should provide sufficient coverage, but a new end-to-end test is recommended to provide extra confidence.