Wilfred / difftastic

a structural diff that understands syntax 🟥🟩
https://difftastic.wilfred.me.uk/
MIT License
20.68k stars 339 forks source link

Support configurable file associations #52

Open Wilfred opened 2 years ago

Wilfred commented 2 years ago

For example, TARGETS is usually python syntax (specifically starlark), but has no file extension.

crides commented 2 years ago

I would like to see configurable filetype associations, like the ones present in ripgrep. Some files may have custom extensions, but may use syntax trees from other languages. An example is the new Kicad project files, where they are essentially S-exprs, and should be diffed as such

Wilfred commented 2 years ago

@crides agreed, configurable file associations would be nice.

(FWIW I'm not sure Kicad would work well as there's no generic s-expression parser in difftastic today.)

crides commented 2 years ago

Kicad actually works fairly well. I simply modded the file detection to map kicad files to Common Lisp. The only thing that's a bit hard is because it's not manually edited (well not most of the time anyway) and the order of some of the elements don't actually matter, but the unorderedness would make diffing possibly very hard. So for now, everything works well enough.