Live data from Hacker News

Difftastic: A diff that understands syntax

github.com

51–60 of 224 posts

Re: Difftastic: A diff that understands syntax

#51
post #46
post #42

Earlier quoted context omitted.

I think it's wonderful that there's an explosion of new exciting languages, it can only improve the quality of all our tools. I for one am looking forward to replacing my eons of MATLAB experience with Julia. But I wish there was more of a convention in the F/OSS community that if your software isn't written in something universal (C, C++, shell and maybe python), then it also comes with a container of all that's nec…

>shell >universal * laughs in Windows, then cries *

I used to straddle the two worlds, maintained and supported a multi-site AD domain with AFS integration for user $HOME and some sort of unholy LDAP/kerberos bridge for login. About once every year or two I'll miss something about the way Windows does things, compared to normal (meaning "linux"). Like the NTFS permissions model, that's cool.

But it's just once a year :) And the last time I was deep in windows was win7, whenever that was. I tried to use a win10 machine and gave up.

Besides, I thought the big new feature in modern windows was that WSL improved to the point you can run unix tools! ;)

Re: Difftastic: A diff that understands syntax

#52
post #34

Earlier quoted context omitted.

Used `cargo install difftastic`? Finished in a minute for me.

Build errors for me. Apparently I'm on some nightly build of cargo, but I need 2021 version. The pain begins... Edit: Reinstalling Cargo worked!

With rustup, it's pretty easy to update/change your cargo version.

Re: Difftastic: A diff that understands syntax

#53
I would love it if version control stored an AST that also includes comments and dividers (where right now we would leave an empty line) and dev machines rendered it out however they wanted. They could even change the language of keywords in addition to normal formatting.

Re: Difftastic: A diff that understands syntax

#54
post #13

Earlier quoted context omitted.

JSON is supported. HTML and XML are missing, too.

You're right. I missed JSON. Sadly YAML, TOML and the others I mentioned are not there (yet?)

There’s always room for contributions!

Re: Difftastic: A diff that understands syntax

#55

First thing that came to mind is diffing python notebooks.

For Jupyter Notebooks I highly recommend trying out jupytext, which converts Notebooks on the fly to a number of formats. It really has been a game changer for working with git and Notebooks for me. I essentially never want to preserve state of the notebooks anyway so converting just makes sense. The best thing is it is completely transparent, i.e. it generates a notebook file when you open the other file and saves to the file ever time the notebook is saved. If you want to keep the state of the notebook you can always keep that file around as well.

Re: Difftastic: A diff that understands syntax

#57
post #53

I would love it if version control stored an AST that also includes comments and dividers (where right now we would leave an empty line) and dev machines rendered it out however they wanted. They could even change the language of keywords in addition to normal formatting.

Yep, I posted this idea on Reddit recently and people said they need a formatted syntax because of diff and version control; we do not; get the ast, reformat in the editor as the particular user fancies and generate diff and version control artefacts also as a particular user sees fit. Our computers are very fast so you can make a lot more different views on your code than we have now by using the ast instead of text and regexps.

Re: Difftastic: A diff that understands syntax

#58
post #34

Earlier quoted context omitted.

Used `cargo install difftastic`? Finished in a minute for me.

Build errors for me. Apparently I'm on some nightly build of cargo, but I need 2021 version. The pain begins... Edit: Reinstalling Cargo worked!

How did you do it? When I tried to rebuild cargo I got build errors. I'm starting to suspect the only way to run this tool is make a chroot tracking sid or something....

Re: Difftastic: A diff that understands syntax

#59
post #53

I would love it if version control stored an AST that also includes comments and dividers (where right now we would leave an empty line) and dev machines rendered it out however they wanted. They could even change the language of keywords in addition to normal formatting.

This exact project is called JetBrains MPS.

Re: Difftastic: A diff that understands syntax

#60
post #5

This looks absolutely amazing. One thing I do find interesting (and a wish were different) is that only programming languages are supported, rather than data formats as well. For example, two JSON documents may be valid but formatted slightly differently, or a common task for me is comparing two YAML files. Comparing config files that have a well defined syntax and or can be abstracted into a tree (JSON, YAML, TOML,…

I would naively expect that this problem is easiest to solve for languages like JSON that have an unambiguous way to be pretty printed.
Post reply on HN