astexplorer icon indicating copy to clipboard operation
astexplorer copied to clipboard

Highlighting between Code<-> AST doesn't work with Recast as parser

Open bantic opened this issue 7 years ago • 3 comments

When Recast is selected, clicking in the code (on the left-hand side) or mousing over the AST (on the right-hand side) does not highlight the corresponding part of the AST/code, respectively. I've used astexplorer in the past and I thought that this used to work. Switching to another parser, for example esprima, brings back the Code<->AST highlighting, as expected.

bantic avatar Jul 26 '18 16:07 bantic

Thanks for the report, I will look into it.

fkling avatar Aug 03 '18 23:08 fkling

This seems to be a problem with recast. Recast itself supports multiple parsers, however, it does not pass the range option to esprima: https://github.com/benjamn/recast/blob/56b676f179547c8c5634b93a134b7878fc861c47/parsers/esprima.js#L12-L21.

I created a PR to fix this.

fkling avatar Sep 10 '18 05:09 fkling

I noticed that the above linked issue has been merged:

  • https://github.com/benjamn/recast/pull/536

I was wondering what the state of this issue is, whether it's been fixed in AST Explorer, and if so, whether it can be closed.

0xdevalias avatar Jul 10 '23 02:07 0xdevalias