Skip to content

Bug: Ampersand breaks jsx_text #366

@Jeaciaz

Description

@Jeaciaz

The following piece of code is valid but it is parsed incorrectly:

export const a = <div>me & you</div>

Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript:
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wG4AocpAD0ljjQgDsBneFOAXjgB4ATYADcAfCCRwAZHACeEAK48A9AJFA

I unfortunately couldn't get the CLI to find installed languages (if absolutely required, they are located in ~/.local/share/nvim/lazy/nvim-treesitter; if someone could help me find what I need to add to ~/.config/tree-sitter/config.json, I can absolutely do that). However, nvim's :InspectTree could hopefully be enough to paint the picture:

Image

There was a very similar issue with ampersands in jsx attributes - it was remedied, however the jsx_text node is still broken.

Also if the ampersand if a part of an html entity, the parser works as expected:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions