js2-mode icon indicating copy to clipboard operation
js2-mode copied to clipboard

JSX double-nesting bug

Open bmalehorn opened this issue 9 years ago • 2 comments

While JSX parsing does work on nesting elements, it can't go JS -> JSX -> JS -> JSX indefinitely.

Specifically, this expression does not parse right:

( <div> { (<div></div>) } </div> );

parse

It appears the inside <div></div> is parsed as JS, which messes up the parsing for the rest of the line.

While the above example is a bit contrived, but it's not uncommon to write an expression like:

<div> { foos.map((foo) => (<Foo id={foo.id}/>) } </div>

bmalehorn avatar Mar 18 '17 00:03 bmalehorn

@wyuenho Yup, it seems fixed in that branch.

bmalehorn avatar May 17 '18 02:05 bmalehorn

Oops sorry, this seems to be a purely parsing and font-locking bug, which rjsx-mode should have fixed long ago, probably at release. My branch is purely about indentation. I was just searching for JSX indentation bugs in this repo but forgot I had this tab opened.

In any case, rjsx-mode is your friend once my branches are merged :)

wyuenho avatar May 17 '18 03:05 wyuenho