astexplorer icon indicating copy to clipboard operation
astexplorer copied to clipboard

Feature request: Show a diff between parsers

Open hzoo opened this issue 9 years ago • 12 comments

Not sure how we would show this or if we could make it look good but it would be useful (for me at least) to compare the AST tree between different parsers (in particular babel/esprima for babel-eslint). :smile:

hzoo avatar Dec 09 '15 14:12 hzoo

I was going to make diff for before/after transform, but between parsers? Dunno, looks like too specialized and rare task IMO... Also, you can use other online tools when needed for this http://tlrobinson.net/projects/javascript-fun/jsondiff/

RReverser avatar Dec 09 '15 14:12 RReverser

I know of at least one other person who wants this ;) I guess computing the diff shouldn't be too difficult, but I'm wondering what a good visualization would look like. Worst case: patch-style JSON diff I guess.

fkling avatar Dec 09 '15 14:12 fkling

:grin: there's gota be a few people!

Need to decide what to show for

  • removed/added properties
  • changed properties

and maybe a filter for things that are the same?

hzoo avatar Dec 09 '15 14:12 hzoo

I know of at least one other person who wants this ;)

Wants diff between different parsers? But in most cases they return very different ASTs (except of ESTree-based, which are minority although have some discrepancies)

RReverser avatar Dec 09 '15 14:12 RReverser

Might help to find those discrepancies in ESTree so we can make some PRs (if we didn't already know about them)

hzoo avatar Dec 09 '15 14:12 hzoo

@hzoo Those discrepancies are intentional - either internal properties required for parser work (babylon 5, acorn, espree) or complete forks of ESTree (babylon 6), so PRs won't be accepted.

RReverser avatar Dec 09 '15 14:12 RReverser

@RReverser: diffs between ASTs in general.

fkling avatar Dec 09 '15 14:12 fkling

@fkling I don't really see where it would fit into UI of this tool (if it's generic comparison and not pre-transform vs post-transform, which I do agree is useful), but maybe I'm just missing something.

RReverser avatar Dec 09 '15 15:12 RReverser

@RReverser: Yeah, I think pre-/post-transform would make sense. But I also agree that is becoming more difficult to extend the UI. Maybe we have to introduce tabs or something ;)

fkling avatar Dec 09 '15 15:12 fkling

@fkling window.open #justsaying :P

RReverser avatar Dec 09 '15 15:12 RReverser

I was going to make diff for before/after transform,

@RReverser did you ever make this?

swyxio avatar Jun 26 '18 03:06 swyxio

Nope.

RReverser avatar Jun 27 '18 21:06 RReverser