rfx
rfx copied to clipboard
Elixir-Native Diff and Patch
Rfx needs diff
and patch
functions. For prototyping, these are implemented with System.call("diff", ...)
. This workaround will work on Linux systems, but not on Windows. We need a Elixir native implementation of diff
and patch
.
See Module: Rfx.source
.
A bit more on this issue:
- we only need diff for strings - not for structs, lists etc
- we desire to limit the number of 3rd party dependencies - solutions based on 'stdlib' and/or plain elixir code are preferred
- the exact format of the diff data structure doesn't matter - if we need to output a specific data format we can use a converter
- it must be possible to serialize the diff data structure to/from JSON
Definitely agreed on minimizing the 3rd party dependencies :)
ElixirLS has a myers_diff_to_text_edits function that might serve as good inspiration: https://github.com/elixir-lsp/elixir-ls/blob/6a786d7d9e7ca97a2c9c77ea4acd0057a98734d8/apps/language_server/lib/language_server/providers/formatting.ex#L72