Giter Club home page Giter Club logo

Comments (3)

luzpaz avatar luzpaz commented on September 18, 2024 2

@Wilfred has there been any progress on your thinking about this ? (sorry for the necrobump)

from difftastic.

Wilfred avatar Wilfred commented on September 18, 2024

This is definitely I'm interested in future, but it's too early right now. The API is still changing a lot as I figure out how make a design that actually works.

from difftastic.

the-moog avatar the-moog commented on September 18, 2024

@luzpaz I was the person who made the reqeust over at GNOME. https://gitlab.gnome.org/GNOME/meld/-/issues/756

I noticed this PR that adds a library interface, though that has not been looked at for well over a year. I guess this makes sense as it's not worth publishing an API for a moving target.

Perhaps there is another, simple way to add difft as a backend to meld?

There is a feature (experimental) where difftastic emits a simple json file with the --display <MODE> option.
Could that be used with a temp file, named pipe or Bekeley socket until there is a more direct interface?

Example below...

Note this was generated a file with few characters (~15) and a tiny change. I am wondering if JSON is the best way to communicate that change information? For a large file the diff data could be massive. There are binary alternatives for arbitrary data serialisation that would be more efficient. e.g. Apache Thrift? Or maybe do it live with a socket and a virtual cursor - next/prev/print/count etc that would mean far less data to transfer.

before (lhs comma rhs) -> [(lhs) comma rhs] after

 DFT_UNSTABLE=yes target/debug/difft \
  --display json \
  sample_files/change_outer_before.el \
  sample_files/change_outer_after.el
{
  "chunks": [
    [
      {
        "lhs": {
          "line_number": 0,
          "changes": [
            { "start": 0, "end": 1, "content": "(", "highlight": "delimiter" },
            { "start": 14, "end": 15, "content": ")", "highlight": "delimiter" }
          ]
        },
        "rhs": {
          "line_number": 0,
          "changes": [
            { "start": 0, "end": 1, "content": "[", "highlight": "delimiter" },
            { "start": 1, "end": 2, "content": "(", "highlight": "delimiter" },
            { "start": 5, "end": 6, "content": ")", "highlight": "delimiter" },
            { "start": 16, "end": 17, "content": "]", "highlight": "delimiter" }
          ]
        }
      }
    ]
  ],
  "language": "Emacs Lisp",
  "path": "sample_files/change_outer_after.el",
  "status": "changed"
}

from difftastic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.