virchau13 / tree-sitter-astro

Tree-sitter grammar for the Astro web framework
MIT License
98 stars 9 forks source link

Add JavaScript expressions support #6

Closed joshmedeski closed 1 year ago

joshmedeski commented 1 year ago

The Astro component template supports JSX-like syntax for JavaScript expressions.

<!-- Mix HTML with JavaScript expressions, similar to JSX: -->
<ul>
  {myFavoritePokemon.map((data) => <li>{data.name}</li>)}
</ul>
Screenshot 2022-12-26 at 2 47 15 PM

As you can see, this isn't supported yet by this plugin. Can we add this feature? I'm new to treesitter development but I'm happy to help if I'm given some resources or direction on how to do this.

virchau13 commented 1 year ago

Highlighting JSX does work: image

Try https://github.com/virchau13/tree-sitter-astro#parser-dependencies

joshmedeski commented 1 year ago

Sweet, I didn't have tsx installed yet so :TSInstall tsx did the trick!