afnanenayet / diffsitter

A tree-sitter based AST difftool to get meaningful semantic diffs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle unknown files gracefully

j-martin opened this issue · comments

Is your feature request related to a problem? Please describe.

In this discussion which spanned from #155 it was noted that diffsitter cannot handle files it does not have the grammar for. This is an issue when trying to show diff in a git repository with a mix of supported and unsupported files.

Describe the solution you'd like
It would be nice if diffsitter was able to show diffs the same way that diff shows diff when the files are not supported. I'd be happy even if it only invoked diff in the background

Describe alternatives you've considered
With an intermediary script I guess it could achieve naively this way: diffsitter "$@" || diff "$@". It has been suggested to use .gitattribute for the git case, but this won't scale beyond the git usecase.

Yeah I suppose we could do that. I think I'd prefer having this be a configurable option with an error being the default behavior, maybe have a "passthrough" option that invokes another executable if diffsitter doesn't support the file type?

Great! Any idea if you are planning a new release soon?

Hey, sorry about this, missed your comment, but I pushed 0.6.7 recently, and also set up nightly builds.

No worries!

Just confirming the change works well. I just had to figure out where exactly to put the config. #249