The latest developments on pullrequests comments have brought us to change the way the side-by-side and the unified diffs are generated.
We had to fix some issues, and having this complex feature written in Vanilla Javascript makes it really hard to debug them.
The TypeScript parser will help us to spot clumsy things and make the whole feature more solid.
The strategy is to migrate first files having no dependencies on codemirror, then migrate the ones having some.
The first files that can be migrated with a certain ease are :
- code-collapse-service -> defines which sections of code can be folded (e.g untouched lines between two versions of a file) ✅
- side-by-side-line-grouper -> builds groups of lines by their states (added, deleted, untouched) ✅
- diff-mode-state -> tells if the diff is displayed in unified or side-by-side mode ✅
- inline-comments-positions -> only exports constants ✅
Then we can migrate :
- side-by-side-scroll-synchronizer -> Uses codemirror Editor ✅
- side-by-side-widget-positionner -> Uses codemirror Handles ✅
- side-by-side-line-mapper -> Uses codemirror Handles and Editor ✅
- side-by-side-widget-finder -> Uses codemirror Widgets and Handles ✅
- side-by-side-line-height-equalizer -> Uses codemirror Editor, Handles and Widgets ✅
- side-by-side-comment-placeholder-builder -> Uses codemirror Editor, Handles and Widgets ✅
Once all the files have been migrated to TypeScript, we'll have to extract some logic from side-by-side-component - which is not unit tested - and split it into smaller objects. To achieve that, we'll have first to:
- Migrate new-inline-comment-component to Hybrids + TypeScript ✅
- Extract the widgets creation part out of codemirror-helper-service (which is an angular.js service) ✅
Then, we'll normally be able to extract and split the management of widgets in codemirrors from the master component.
- Insertion of comment and their placeholders on the opposite side ✅
- Insertion of the new-inline-comment-form and their placeholders on the opposide side ✅
- Insertion of code placeholders ✅
[Bonus]
We could also migrate the codemirror-helper-service out of angular, in a unit tested TypeScript object. ✅