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

Svelte 5 Snippets Cause Language Tools ParseError #2344

Closed
mjadobson opened this issue Apr 21, 2024 · 1 comment
Closed

Svelte 5 Snippets Cause Language Tools ParseError #2344

mjadobson opened this issue Apr 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mjadobson
Copy link

Describe the bug

When saving/formatting this file in VSCode with Svelte Extension:

App.svelte:

{#snippet Item()}
  test
{/snippet}

The Svelte extension outputs this error:

CompileError [ParseError]: Expected if, each or await
> 1 | {#snippet Item()}
    |  ^
  2 |   test
  3 | {/snippet}
  4 |
    at error (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/svelte/compiler.js:13213:20)
    at Parser$1.error (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/svelte/compiler.js:13291:10)
    at mustache (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/svelte/compiler.js:12868:21)
    at new Parser$1 (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/svelte/compiler.js:13250:22)
    at Object.parse$b [as parse] (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/svelte/compiler.js:13390:21)
    at Object.parse (/Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/prettier-plugin-svelte/plugin.js:2287:65)
    at parse4 (file:///Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/prettier/index.mjs:22117:24)
    at async coreFormat (file:///Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/prettier/index.mjs:22607:7)
    at async formatWithCursor (file:///Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/prettier/index.mjs:22809:14)
    at async Module.format2 (file:///Users/matthewdobson/.vscode/extensions/svelte.svelte-vscode-108.3.4/node_modules/prettier/index.mjs:24194:25) {
  code: 'expected-block-type',
  start: { line: 1, column: 2, character: 2 },
  end: { line: 1, column: 2, character: 2 },
  pos: 2,
  filename: undefined,
  frame: '1: {#snippet Item()}\n     ^\n2:   test\n3: {/snippet}',
  loc: {
    start: { line: 1, column: 2, character: 2 },
    end: { line: 1, column: 2, character: 2 }
  },
  codeFrame: '> 1 | {#snippet Item()}\n    |  ^\n  2 |   test\n  3 | {/snippet}\n  4 |'
}
Using Svelte v5.0.0-next.95 from /Users/matthewdobson/project
Preprocessing failed

Reproduction

See above

Expected behaviour

No ParseError

System Info

  • OS: MacOS
  • IDE: VSCode 1.88.1
  • Svelte for VSCode: 108.3.4
  • Svelte v5.0.0-next.95

Which package is the issue about?

Svelte for VS Code extension, svelte-language-server

Additional Information, eg. Screenshots

No response

@mjadobson mjadobson added the bug Something isn't working label Apr 21, 2024
@mjadobson
Copy link
Author

Just found this is dupe of #2338 (comment)

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

1 participant