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

Multiple <template> tags in the same file emits an error #810

Closed
GrygrFlzr opened this issue Feb 9, 2021 · 1 comment
Closed

Multiple <template> tags in the same file emits an error #810

GrygrFlzr opened this issue Feb 9, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@GrygrFlzr
Copy link
Member

GrygrFlzr commented Feb 9, 2021

Describe the bug
Attempting to use multiple <template> tags in the same file emits an error:

</template> attempted to close an element that was not open
svelte(invalid-closing-tag)

To Reproduce

<template>
    <h1>Hello</h1>
</template>
<template>
    <h1>How are you</h1>
</template>

Expected behavior
No errors.

Screenshots
image
image

System:
Visual Studio Code on Windows

Version: 1.53.0 (user setup)
Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496
Date: 2021-02-03T20:36:38.611Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042

Plugin/Package: Svelte for VSCode (svelte.svelte-vscode) and confirmed the old extension is not installed.

Additional context
#694 is likely related (which is not fully fixed), as is FredKSchott/snowpack/discussions/2595.
EDIT: latter is related to svelte-preprocess insted at sveltejs/svelte-preprocess#310

It's likely that it is greedily parsing the contents from the first opening tag to the last closing tag.

I thought this may have been either a Svelte or HTML limitation at first, but it seems to work with no issues:

  • in the REPL
  • in a fresh instance of Svelte with Rollup
  • in a fresh instance of Sapper with Rollup

This leads me to believe that multiple <template> tags is valid and it is the extension that is incorrect.

@GrygrFlzr GrygrFlzr added the bug Something isn't working label Feb 9, 2021
@dummdidumm
Copy link
Member

#694 is unrelated, that's only highlighting. The problem is inside svelte-preprocess. Therefore I'll close this issue. We will bump the svelte-preprocess version once it's fixed other there, then the VS Code error should go away, too.

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

2 participants