Skip to content

moving a .svelte file incorrectly updates relative imports #1625

@teemingc

Description

@teemingc

Describe the bug

Whenever I move a .svelte file, any import that uses a relative path such as ./$types (which is common in sveltekit) gets automatically updated to something incorrect.

Currently, there is no option to turn off automatic import updates, when moving a .svelte file, to avoid this problem.

Ideally, there would be options for prompt, always, and never similar to the TypeScript extension setting typescript.updateImportsOnFileMove.enabled.

Reproduction

Before moving from src/routes/a/b:
CleanShot 2022-09-07 at 22 27 29@2x

After moving to src/routes/b:
CleanShot 2022-09-07 at 22 28 42@2x

Expected behaviour

It should either resolve to the correct relative path, or not change it at all (if updating is disabled).

CleanShot 2022-09-07 at 22 31 56@2x

I don't think there's a way to keep SvelteKit generated types as './$types' as it doesn't exist until the types are generated again.

System Info

  • OS: macOS Monterey 12.5.1 (21G83)
  • IDE: VSCode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

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