microsoft / microsoft/TypeScript

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

オープン
#63,852 コメント 1 件 リアクション 4 件 担当者 1 名 GitHub で見る

@andrewbranch がすでに取り組んでいます。

2026年7月15日 から。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。