Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Blade Component dot notation issue when parsed by tree-sitter-html #62

Open
EmranMR opened this issue Mar 18, 2024 · 8 comments
Open
Labels
bug Something isn't working

Comments

@EmranMR
Copy link
Owner

EmranMR commented Mar 18, 2024

Bug whereby nested blade components are not parsed correctly via the tree-sitter-html

see the discussion

Laravel Docs

@EmranMR EmranMR changed the title Nested Blade component Nested Blade component issue Mar 18, 2024
@EmranMR EmranMR added the bug Something isn't working label Mar 18, 2024
@calebdw
Copy link
Contributor

calebdw commented Mar 18, 2024

This has nothing to do with nested components, just trying to use the same ending tag as the start:

<x-card.title>
</x-card.title>

<!-- This works, just some lsps expect the start tag to match the end -->
<x-card.title>
</x-card>

@EmranMR
Copy link
Owner Author

EmranMR commented Mar 18, 2024

@calebdw But in the discussion it seems that there is an issue with tree-sitter-html giving an error even when the start and end tag matches no? Basically the dot notation is not allowed for naming the tags?

<x-card.title>
</x-card.title>

@EmranMR
Copy link
Owner Author

EmranMR commented Mar 18, 2024

Also is this a valid Laravel Blade syntax? never came across it!

<x-card.title>
</x-card>

@calebdw
Copy link
Contributor

calebdw commented Mar 18, 2024

Ah, by "nested" I thought you were talking about components inside other components:

<x-card>
    <x-card.title>
    </x-card.title>
</x-card>

All that happens is a slight parse error in html (it just affects the highlighting of the extra ending)---however, some lsps will not recognize that those are matching tags since they expect the start and end tags to be the same.

@EmranMR
Copy link
Owner Author

EmranMR commented Mar 18, 2024

haha my bad! need to rename the title, to avoid confusion! This was also mainly to track possible tree-sitter-html extension experimentation! 👀
After the php_only merge, it seems like a natural way to go forward now! My semester is finished so I should hopefully find some time to tackle some of the issues, and experiment a bit!

@EmranMR EmranMR changed the title Nested Blade component issue Nested Blade Component dot notation issue when parsed by tree-sitter-html Mar 18, 2024
@anotherfrontendguy
Copy link

anotherfrontendguy commented Mar 19, 2024

Also is this a valid Laravel Blade syntax? never came across it!

<x-card.title>
</x-card>

A little late but just to clarify: this is NOT valid syntax.

Basically the dot notation is not allowed for naming the tags?

And yes, I think this is ecaxctly what it boils down to.


Also a little gotcha regarding this (don't know if this is relevant for you) but these tags can be self closing too, like this:

<x-inputs.button/>

@calebdw
Copy link
Contributor

calebdw commented Mar 19, 2024

A little late but just to clarify: this is NOT valid syntax.

This syntax does work:

<x-card.title>
</x-card>

@anotherfrontendguy
Copy link

anotherfrontendguy commented Mar 19, 2024

Yes it works, but it would not be valid syntax.

This would be the equivalent of opening a tag and closing a different one:

<p>
</div>

To be fair this would "work" because browsers are smart these days, but it's still invalid because it's missing and end tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants