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

fix(scanner): allow periods in tag names #4

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

michenriksen
Copy link
Contributor

Includes periods when scanning tag names to allow for a common design with Svelte components, where multiple components are imported under a single namespace, such as this example from shadcn-svelte:

<script lang="ts">
  import * as Card from "$lib/components/ui/card";
</script>

<Card.Root>
  <Card.Header>
    <Card.Title>Card Title</Card.Title>
    <Card.Description>Card Description</Card.Description>
  </Card.Header>
  <Card.Content>
    <p>Card Content</p>
  </Card.Content>
  <Card.Footer>
    <p>Card Footer</p>
  </Card.Footer>
</Card.Root>

This problem was mistakenly reported in Himujjal/tree-sitter-svelte#58 which is another Tree-Sitter grammar for Svelte.

Includes periods when scanning tag names to allow for a common design
with Svelte components, where multiple components are imported under
a common namespace, such as:

```
<script lang="ts">
  import * as Card from "$lib/components/ui/card";
</script>

<Card.Root>
  <Card.Content>
    . . .
  </Card.Content>
</Card.Root>
```
@amaanq
Copy link
Member

amaanq commented Jun 15, 2024

nice! thank you!!

@michenriksen
Copy link
Contributor Author

@amaanq I can see that the pipeline fails, but that seems to be because of changes from 7218cf6, so not related to this change.

The unit tests pass fine:

Run tree-sitter test
  html:
    main:
        1. ✓ Tags
        2. ✓ Tags with attributes
        3. ✓ Nested tags
        4. ✓ Void tags
        5. ✓ Void tags at EOF
        6. ✓ Custom tags
        7. ✓ Comments
        8. ✓ Raw text elements
        9. ✓ LI elements without close tags
       10. ✓ DT and DL elements without close tags
       11. ✓ P elements without close tags
       12. ✓ Ruby annotation elements without close tags
       13. ✓ COLGROUP elements without end tags
       14. ✓ TR, TD, and TH elements without end tags
       15. ✓ Named entities in tag contents
       16. ✓ Numeric entities in tag contents
       17. ✓ Multiple entities in tag contents

@michenriksen
Copy link
Contributor Author

Hi @amaanq and @ObserverOfTime, is anything holding this PR back from being merged? I would love to have this issue fixed in my Neovim. 🙏

@ObserverOfTime ObserverOfTime requested a review from amaanq June 18, 2024 16:52
@michenriksen
Copy link
Contributor Author

Hi @amaanq, can this be merged in, please? 🙏

@michenriksen
Copy link
Contributor Author

Hi @amaanq and @ObserverOfTime, me again with another ping to ask if this PR can be merged, please?

Syntax highlighting in Neovim currently breaks in horrible ways when tags contain periods, and nvim-treesitter provides no easy way to override the configured grammar source repositories as far as I can see. So it would be very helpful to have this bug corrected.

@amaanq amaanq merged commit 7ab8221 into tree-sitter-grammars:master Jul 20, 2024
2 of 5 checks passed
@amaanq
Copy link
Member

amaanq commented Jul 20, 2024

super sorry @michenriksen, got caught up with stuff 😅 thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants