sveltejs/language-tools

Auto format doesn't work with {@render }

Closed this issue · 2 comments

Describe the bug

seems auto-format doesn't work whenever there's a {anything here} declaration

Reproduction

<script>
    let { children } = $props();
</script>

<div class="outer">
    <div class="inner">
        <div class="container">
            {@render children()}
        </div>
        
        
    </div>
</div>

^will not auto format, comment out the line <!-- {@render children()} --> allows it to work again

Expected behaviour

expect auto format, in the case of the example, extra lines between the divs should be removed

System Info

  • OS: Windows
  • IDE: VSCode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

in addition, I closed and reopened vs code and now am getting a red squiggly on that line:
image

'children' is of type 'unknown'

everything still works, just a ts false error (not sure if should file separate bug)

wasn't there for the last 2 hrs

Duplicate of #2338. Svelte 5 currently require a workspace version of prettier-plugin-svelte and a prettier config file.

https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Bprettier/.prettierrc

As for the second issue, in SveltKit's route files, the snippet children props may have auto-typing, but it needs explicit typing in other components.

<script>
    /**
     * @type {{children: import('svelte').Snippet}}
     */
    const {
        children
    } = $props();
</script>