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

expressions containing newlines breaks #61

Open
AlbertMarashi opened this issue Sep 5, 2024 · 2 comments
Open

expressions containing newlines breaks #61

AlbertMarashi opened this issue Sep 5, 2024 · 2 comments

Comments

@AlbertMarashi
Copy link

AlbertMarashi commented Sep 5, 2024

PR #50 broke something which was merged into zed and is now affecting my code.

Test case:

<script>
let foo = {
    bar: "baz"
}
</script>
<foo
    baz={{
    
    }}>

    {#if foo.bar}
        { foo.bar }
    {/if}
</foo>
<style>
foo {
    display: flex;
    flex-direction: column;
}
</style>

image

For some reason, newlines within the baz prop appear to break parsing

If I remove the newlines, it parses

image

Downgrading the zed extension's commit version to #49's fixes the bug, so something in here seems like it was introduced which broke parsing.

maxdeviant pushed a commit to zed-industries/zed that referenced this issue Sep 5, 2024
Closes: #17310

This PR #17364 broke my svelte
code, downgrading to the previous commit SHA
`b08d070e303d2a385d6d0ab3add500f8fa514443` fixes the issue.

Until the following issue is resolved, the commit SHA should not be
updated

- tree-sitter-svelte issue I filed:
Himujjal/tree-sitter-svelte#61

Release Notes:

- N/A
@AlbertMarashi AlbertMarashi changed the title Parser breaking with object literals containing newline breaks parsing props containing newlines breaks Sep 5, 2024
@AlbertMarashi
Copy link
Author

Simpler test case:

Works:

{{ "foo": "bar" }}

Breaks

{{
   "foo": "bar"
}}

@AlbertMarashi AlbertMarashi changed the title props containing newlines breaks expressions containing newlines breaks Sep 5, 2024
@AlbertMarashi
Copy link
Author

AlbertMarashi commented Sep 5, 2024

I believe a bunch of faulty logic was added inside of: https://github.com/Himujjal/tree-sitter-svelte/blob/master/src/scanner.c#L270-L273

I placed some review comments on the commit

maxdeviant pushed a commit to zed-extensions/svelte that referenced this issue Oct 18, 2024
Closes: zed-industries/zed#17310

This PR zed-industries/zed#17364 broke my svelte
code, downgrading to the previous commit SHA
`b08d070e303d2a385d6d0ab3add500f8fa514443` fixes the issue.

Until the following issue is resolved, the commit SHA should not be
updated

- tree-sitter-svelte issue I filed:
Himujjal/tree-sitter-svelte#61

Release Notes:

- N/A
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

No branches or pull requests

1 participant