rfx icon indicating copy to clipboard operation
rfx copied to clipboard

Elixir-Native Diff and Patch

Open andyl opened this issue 3 years ago • 3 comments

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.

andyl avatar Jun 04 '21 23:06 andyl

Possible helper tools:

andyl avatar Jun 29 '21 22:06 andyl

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

andyl avatar Jul 02 '21 03:07 andyl

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

axelson avatar Jul 05 '21 07:07 axelson