Replace DiffPlex with a text diff API in DiffEngine - #909
Merged
Merged
Conversation
Add a public, dependency free line diff to DiffEngine (TextDiff.Compute and TextDiff.Format with Full, Compact and Minimal layouts), and have the viewer use it instead of DiffPlex. DiffPlex.dll no longer ships in any package, and Verify.DiffPlex is removed from the test projects. The diff is Myers in its linear space form, over spans of the original strings: lines are ranges rather than copies, equal lines are numbered by a span keyed table, and buffers come from the stack or ArrayPool. Lines compare exactly, whitespace and case included.
This was referenced Sep 30, 2026
This was referenced Sep 30, 2026
This was referenced Sep 30, 2026
This was referenced Sep 30, 2026
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the DiffPlex dependency. DiffEngine now has its own public line diff, which the viewer uses, and which Verify can use to replace Verify.DiffPlex.
API
Computereturns lines in inline order: unchanged lines, and each changed block as its removed lines followed by its added lines.Formatproduces the three layouts Verify.DiffPlex has, including[BOF]/[EOF]and zero-padded line numbers in Compact.Implementation
ArrayPoolotherwise.Computemakes a string only for each line it returns, andFormatappends spans directly.Differences from Verify.DiffPlex
Formatoutput, not trailing spaces, because a trailing space can now be the difference being reported.\r\nand\ncompare as unchanged.Packages and tests
DiffPlex.dllis removed from every package: six copies in DiffEngine, two in the tray, one in each viewer package. The package listing snapshots are updated to match, and nothing else in them changed.Verify.DiffPlexis removed from the test projects.TextDiffTestscover edge cases, all three formats and a 20,000-line input. A fuzz test checks 3,000 random cases against a brute-force answer, confirming every diff is as small as possible and rebuilds both texts exactly.DiffRowsTestspin how the viewer pairs lines side by side.Follow-up (Verify repos)
TextDiff.Formatas Verify's default string comparer.