You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that " " will end up inside a dom node, so I think there should be a jsx_text node here.
This is not limited to an empty string ie
<div>foo</div>
will result in a dom node with the text " foo " , so if I query for 'is there a jsx_text node with text === ' foo ' tree-sitter-javascript will tell me 'no' but i think the answer should be 'yes'
Advice / pointers
There is a lot of un-specified nuance here. Ie the whitespace rules are not part of the JSX spec (facebook/jsx#143), but are implemented by React (facebook/jsx#40)
Basically, i think the jsx_text node should grow to encapsulate the rules around whitespace rather than trimming always.
The following piece of code is valid but it is parsed incorrectly:
Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript:
https://www.typescriptlang.org/play/?#code/DwEwlgbgfABKkHorAeaQ
The output of
tree-sitter parse
is the following:This is wrong because there is no jsx_text node
but as seen in the ts playground link
tsc
will outputNote that " " will end up inside a dom node, so I think there should be a jsx_text node here.
This is not limited to an empty string ie
will result in a dom node with the text " foo " , so if I query for 'is there a jsx_text node with text === ' foo ' tree-sitter-javascript will tell me 'no' but i think the answer should be 'yes'
Advice / pointers
There is a lot of un-specified nuance here. Ie the whitespace rules are not part of the JSX spec (facebook/jsx#143), but are implemented by React (facebook/jsx#40)
Basically, i think the jsx_text node should grow to encapsulate the rules around whitespace rather than trimming always.
Relevant: #227
The text was updated successfully, but these errors were encountered: