Skip to content

Duplicate auto-import suggestions for re-exported .svelte components #2888

@tmvc03

Description

@tmvc03

Describe the bug

When a Svelte component is re-exported from an index.ts file, VSCode auto-import shows two suggestions for the same symbol:
one from the .svelte file itself, and one from the barrel export (index.ts).

This creates confusion and inconsistent import paths across the codebase.

Reproduction

  1. Create a folder structure:
src/
  entities/
    user/
      ui/
        UserAvatar.svelte
      index.ts
  1. In entities/user/index.ts:
export { default as UserAvatar } from './ui/UserAvatar.svelte';
  1. In another file (e.g. src/pages/Home.svelte), try to import the component:
<script lang="ts">
  import { UserAvatar } from ...
</script>
  1. Observe that VSCode offers two auto-import suggestions:
  • entities/user
  • entities/user/ui/UserAvatar.svelte

Expected behaviour

Only one suggestion should appear — ideally the barrel export (entities/user) since it’s a valid re-export of the component.

System Info

vscode

Version: 1.106.0 (Universal)
Commit: ac4cbdf48759c7d8c3eb91ffe6bb04316e263c57
Date: 2025-11-11T16:02:25.943Z (1 day ago)
Electron: 37.7.0
ElectronBuildId: 12597478
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

extension

Identifier: svelte.svelte-vscode
Version: 109.12.0

package.json, tsconfig, etc...

used from template https://github.com/vitejs/vite/tree/main/packages/create-vite/template-svelte-ts

Which package is the issue about?

No response

Additional Information, eg. Screenshots

Screen.Recording.2025-11-13.at.11.43.42.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions