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

Elixir-Native Diff and Patch #2

Open
andyl opened this issue Jun 4, 2021 · 3 comments
Open

Elixir-Native Diff and Patch #2

andyl opened this issue Jun 4, 2021 · 3 comments

Comments

@andyl
Copy link
Owner

andyl commented Jun 4, 2021

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
Copy link
Owner Author

andyl commented Jun 29, 2021

Possible helper tools:

@andyl andyl changed the title Native Diff and Patch Elixir-Native Diff and Patch Jun 29, 2021
@andyl
Copy link
Owner Author

andyl commented Jul 2, 2021

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

@axelson
Copy link

axelson commented Jul 5, 2021

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

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

No branches or pull requests

2 participants