Skip to content

Auto import does not respect paths #2422

@longzheng

Description

@longzheng

Extension Version

0.20251222.1

VS Code Version

1.107.1

Operating system Version

Windows_NT arm64 10.0.26200

Steps to reproduce

  1. Clone https://github.com/longzheng/typescript-go-import-path-repro
  2. Open index.ts
  3. Try to quick fix missing import for sum()

Issue

Image

The suggestion does not respect the tsconfig paths and "typescript.preferences.importModuleSpecifier": "non-relative"

    "compilerOptions": {
        "paths": {
            "@/*": ["./src/*"]
        }
    }
{
  "typescript.preferences.importModuleSpecifier": "non-relative",
  "typescript.experimental.useTsgo": true
}

I'm expecting

import { sum } from "@/export";

instead of

import { sum } from "./export";

Interestingly if I move index.ts to another subdirectory, like ./src/test then the auto import will suggest the correct path

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: EditorRelated to the LSP server, editor experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions