JSX elements produce different locations depending on component casing
Open
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
In <Div /> the "caller" expression in the produced Pexp_apply node does not include the opening bracket <, it goes from characters 1 to 4.
But in <div /> it does, it goes from 0 to 4.
This is pretty minor, but affects for example the way IDEs and editors add overlays when hovering over elements. In the second case, the overlay would exceed the name of the component.
I'm not sure if this is expected, I checked the place where I believe these locations are set and they seem to be the same 🤔
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the two AST Explorer examples for
and and inspect the location-setting logic at src/reason-parser/reason_parser.mly:971-975. Trace why the produced Pexp_apply caller ranges differ by component casing, then verify that both JSX forms produce consistent locations without exceeding the component name.Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100