Skip to content

Format failed with attribute_empty_shorthand for Snippet with attachment #16932

@korywka

Description

@korywka

Describe the bug

prettier stops formatting when snippet inside tag with attach tag with attribute_empty_shorthand error. svelte check gives no error and this code is compiled successfully.

Reproduction

	<UIButton href="/filters" variant="blur" badge={filtersBadge}>
		{#snippet icon()}
			<svg {@attach svg('/filter.svg')} />
		{/snippet}
	</UIButton>

Logs

2025-10-13T02:15:07+02:00 ERROR [project::lsp_store] Formatting failed: default prettier instance failed to format buffer: attribute_empty_shorthand: Attribute shorthand cannot be empty
https://svelte.dev/e/attribute_empty_shorthand
(unknown):6:8
4:   <UIButton href="/filters" variant="blur" badge={filtersBadge}>
5:     {#snippet icon()}
6:       <svg {@attach svg('/filter.svg')} />
              ^
7:     {/snippet}
8:   </UIButton>
While handling prettier request: {"jsonrpc":"2.0","id":39,"method":"prettier/format","params":{"text":"..snip..","options":{"plugins":["/Users/~/Library/Application Support/Zed/prettier/node_modules/prettier-plugin-svelte/plugin.js"],"parser":null,"filepath":"/Users/~/git/~web/src/components/menu/Menu.svelte","prettierOptions":{"printWidth":120,"useTabs":true,"tabWidth":2},"ignorePath":null

System Info

nodejs

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions