Skip to content

Props removed when saving #2594

@frederichoule

Description

@frederichoule

Describe the bug

When VSCode adds an import automatically, it adds it under the let { data }: { data: PageData } = $props();, which then gets removed when saving, probably due to auto-formatting.

Reproduction

  1. Create a +page.svelte file
  2. Write this: (Normally you wouldn't add the "error" import yourself, it would be added by VSCode when adding that function in your code somewhere in the file.)
import type { PageData } from './$types';
let { data }: { data: PageData } = $props();
import { error } from '@sveltejs/kit';
  1. Save (or format file)
  2. This will result in the let {data} being deleted.
import { error } from '@sveltejs/kit';
import type { PageData } from './$types';

Expected behaviour

Either the import { error } should be added before the let { data } initially, or the formatting tool places it at the correct place and do not delete the let { data }.

System Info

  • OS: macOS 15.1
  • IDE: VSCode 1.95.3

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

CleanShot 2024-11-18 at 07 32 57@2x
CleanShot 2024-11-18 at 07 33 06@2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy