I guess it should be considered as error when // or /* */ is used on jsx tags. May be the node should be called comment and it's direct child as jsx_comment with same range because these kind of comments are only related to jsx tags. For other softwares using this treesitter it might be handy to get to know if it is a jsx comment or not. For example : This commenting plugin for neovim editor was not able to implement jsx support and adding jsx_comment node might be helpful.
.
// and /* */ are considered as comments by treesitter in jsx but {/* */} syntax is the correct comment syntax for jsx like mentioned here.
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?ssl=11&ssc=20&pln=1&pc=1#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wChMBXAOw2AirgEEwwAKASjgG9TS44iMClAas+-OAB4AfOIlwA9AslhpACSQAbTRDgB1aJoAmkharlSFs-uwDcpAL68kAD0iw4RpJhQVN8ZjBbIA
The is not the output of
tree-sitter parse
but the output from tree-sitter playground. I couldn't get thetree-sitter parse
command working.I guess it should be considered as error when
//
or/* */
is used on jsx tags. May be the node should be calledcomment
and it's direct child asjsx_comment
with same range because these kind of comments are only related to jsx tags. For other softwares using this treesitter it might be handy to get to know if it is a jsx comment or not. For example : This commenting plugin forneovim editor
was not able to implement jsx support and addingjsx_comment
node might be helpful. .//
and/* */
are considered as comments by treesitter in jsx but{/* */}
syntax is the correct comment syntax for jsx like mentioned here.