fkling / fkling/astexplorer

Sometimes highlights incorrect part of code

Open
#283 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
6.5k
Forks
772
PR merge metrics
No merged PRs in 30d

Description

I wrote some code in the explorer, but hovering on the AST highlights incorrect part of code. I checked that the parser got it correctly since in the AST I can see `loc.start` and `loc.end` which are correct.
Also interestingly the incorrect highlighting occurs only when I turn on transformations (`jscodeshift`).

Reproducing the bug :
1. Url - https://astexplorer.net/#/gist/19f3253e8b18edff41bd04aa889db30b/367ef808268896551b562adb256ec7833882db4a
2. Parser: recast-0.12.3
3. Transformer: jscodeshift-0.3.30
4. My code -
```js
x = {
kd : merge(
{a : 1, b : 2},
{a : 1, x : 1}
)
};

state = 1;
```
5. Chrome Version 61.0.3163.100 (Official Build) (64-bit)
6. I am also attaching a screenshot of the bug
screen shot 2017-11-15 at 7 07 25 pm

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked AST Explorer reproduction using recast-0.12.3 and jscodeshift-0.3.30, then trace the hover-highlighting behavior when transformations are enabled. Compare the highlighted range with the parser's loc.start and loc.end values for the supplied code. Done means hovering highlights the correct source region in this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.