microsoft / microsoft/TypeScript
Local auto-imports disappear when a Yarn workspace dependency resolves a subpath back to the current project
@andrewbranch 已经在做这个了。
开始于 2026年7月15日。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 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](https://github.com/user-attachments/files/29892001/typescript-go-local-autoimport-repro.zip)
```sh
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:
```text
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:
```text
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:
```ts
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。