[Feature Request] Add support Semantic Diffs
Semantic diffs (https://martinfowler.com/bliki/SemanticDiff.html) take the code review experience a step further by creating diffs that understanding the context and syntax of the changes, reducing the cognitive load on the reviewer. We already have two examples of semantic diffs implemented in the codebase: images and jupyter notebooks (https://docs.gitlab.com/ee/user/project/repository/jupyter_notebooks/#jupyter-notebook-files).
Suggested First Iteration:
- For diff generation, Difftastic (https://github.com/Wilfred/difftastic) is an open-source tool that provides semantic diffs for a variety of languages. It's written in rust for performance, but we can wrap it to be used in rails.
- Move the code that generates the Jupyter Notebook diff to difftastic.
- Add semantic diffs to the Commit diff page, reusing the code that is already implemented for Jupyter Notebook semantic diff display
Concerns
- Generating the semantic diff requires the whole file to be processed, which might cause performance issues that will need to be addressed
Blockers:
Adding semantic diffs to merge requests is currently not possible, since we do not support multiple views for the same file. Until this is solved, the feature cannot be implemented. See #352872 for more context
Edited by 🤖 GitLab Bot 🤖