Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convenience feature for word diff #1

Open
pascalkuthe opened this issue Oct 26, 2022 · 1 comment
Open

Add convenience feature for word diff #1

pascalkuthe opened this issue Oct 26, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@pascalkuthe
Copy link
Owner

Performing a word diff over a full file can be fairly slow on large files.
A better approach is to perform a line diff first and and then perform the word diff on the found changes.
While this is already possible with imara-diff is requires quite a bit of legwork and can be tricky to get right.
It would be nice if this could be included in the library directly.
This has multiple steps for an implementation:

  • Determine the output format. A different trait or force collecting into a Vec?
  • Implement a TokenSource for words
  • Implement a Sink that automatically computes a word diff
  • Potentially implement a heuristic to detect and ignore

The diff algorithm in git only operates on lines. It is worth looking into what exactly they use to produce a colored word diff from the line diff.
Perhaps a different algorithm is a better fit?

@pascalkuthe pascalkuthe added the enhancement New feature or request label Oct 26, 2022
@jlama
Copy link

jlama commented Sep 28, 2023

FYI git does word diffing by feeding the same algorithm with one word per line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants