microsoft / microsoft/TypeScript

Local auto-imports disappear when a Yarn workspace dependency resolves a subpath back to the current project

Offen
#63,852 1 Kommentar 4 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@andrewbranch arbeitet bereits daran.

Seit 15.7.2026.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Extension Version

0.20260708.2 (TypeScript 7.0.2)

VS Code Version

1.128.0 (arm64)

Operating system Version

macOS 26.5.1 (25F80), Apple Silicon

Steps to reproduce

Use the attached typescript-go-local-autoimport-repro folder. It contains two synthetic Yarn workspaces and no application code.

typescript-go-local-autoimport-repro.zip

corepack enable
yarn install
yarn probe

The repository uses Yarn 4.13.0 with nodeLinker: node-modules, TypeScript 7.0.2, and TypeScript 6.0.2 as a control. The TypeScript packages use npm aliases only to prevent Yarn from applying its legacy built-in TypeScript patch.

Expected probe output while the bug is present:

TS7 7.0.2: localValue MISSING
TS7 7.0.2: LocalType MISSING
TS7 bug reproduced.
TS6 6.0.2: localValue FOUND from ./local-symbols
TS6 6.0.2: LocalType FOUND from ./local-symbols
TS6 control passed.

For a manual editor reproduction:

  1. Install and enable the TypeScript 7 extension.
  2. Open the reproduction folder. Its workspace setting enables TypeScript 7.
  3. Open packages/aurora-app/src/consumer.ts.
  4. Type localVal and invoke completions. localValue is not suggested.
  5. Type const sample: LocalTy and invoke completions. LocalType is not suggested.
  6. Disable TypeScript 7 and restart the TypeScript language service. Both symbols are suggested from ./local-symbols by TypeScript 6.
Issue

Package resolution and typechecking work. The missing suggestions are ordinary relative imports between files in the same configured project.

The minimal dependency topology is:

aurora-app -> comet-kit -> aurora-app/back-reference

aurora-app imports @demo/comet-kit. The comet-kit source imports one exported subpath back from @demo/aurora-app. Yarn links both workspaces under the root node_modules.

With the back-reference present, the TypeScript 7 project auto-import bucket contains zero exports from aurora-app, so localValue and LocalType disappear. TypeScript 6 finds both relative imports.

As a control, replace packages/comet-kit/src/index.ts with:

export const packageValue = "package-value";

After restarting TypeScript 7, both local suggestions return. This isolates the regression to the resolved workspace back-reference rather than the tsconfig or the exports themselves.

I suspect the project-bucket optimization is treating the current project as fully covered by a node_modules bucket after recording the back-reference symlink:

https://github.com/microsoft/typescript-go/blob/168e7015edf98244febc8f4ae450b673b5d195d7/internal/ls/autoimport/registry.go#L1236-L1253

This is an inference from the minimal A/B reproduction, not a confirmed implementation fix.

Related issues do not appear to cover this exact case:

  • microsoft/typescript-go#1657 concerns missing package imports from linked workspaces; package imports work here.
  • microsoft/typescript-go#2582 concerns invalidating cached exports after edits to a symlinked workspace package; this fails during initial discovery of the current project's own files.
  • microsoft/TypeScript#63803 concerns package subpath specifiers across local packages; the missing suggestions here should use an ordinary relative path within one configured project.
  • microsoft/typescript-go#3733 concerned new-file and wildcard-directory discovery and was fixed by microsoft/typescript-go#4529; this reproduces in an existing configured file with extension 0.20260708.2.

Expected: local symbols are suggested / Actual: they are absent

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.