EmranMR / tree-sitter-blade

tree-sitter grammar for Laravel blade files
MIT License
186 stars 8 forks source link

JS directive is parsed as a conditional #54

Closed calebdw closed 2 weeks ago

calebdw commented 8 months ago

See comment: https://github.com/EmranMR/tree-sitter-blade/pull/53

EmranMR commented 8 months ago

Can I ask if you have the link for the documentation? I actually came across a few of your pull request on Laravel as well, but could not find any documentation as Taylor suggested there!

Is it AlpineJS > Using the @js directive or a Laravel Directive? :)

calebdw commented 8 months ago

@js started off as a Livewire directive, but was then added to the framework

Not sure why Taylor doesn't want to document it, but it's used in Breeze so :man_shrugging:

EmranMR commented 8 months ago

Haha thanks for that! It's actually handy I didn't know about it myself as well!

EmranMR commented 7 months ago

@calebdw sorry to bother, but could you test the new update with your AlpineJS javascript injection using the following edge case?

<div x-data="{ posts: @js($posts) }">
</div>
calebdw commented 7 months ago

Sorry it took so long!

Here it is below:

image

EmranMR commented 7 months ago

@calebdw no bother! thanks for getting back

I can not see the AST, in relation the javascript injection and the @js($php) I suspect it is all good? Can I go ahead and close this issue? 😊

calebdw commented 7 months ago

Actually, the @js is being parsed as a php_statement---not sure if this is intended:

image

EmranMR commented 7 months ago

@calebdw oh good catch! 🤦‍♂️ Will fix it, that was a mistake!

EmranMR commented 7 months ago

That should be it, all fixed! thanks for catching!