Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

TypeScript 7 VS Code extension: a workspace "typescript" 7.x package is not detected, only "@typescript/native-preview", which is no longer published

未关闭 适合新手
#64,565 0 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@jakebailey 已经在做这个了。

开始于 2026年10月6日。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript, vscode

调研方向

从 packages/vscode-typescript/src/session.ts 开始,尤其检查 findWorkspaceNativePreviewPackages,并检查 promptUseWorkspaceVersion 和 promptSelectVersion 如何使用其结果。将现有的 @typescript/native-preview 检测与 typescript 包和 pathHasTsserverJs 进行比较。当检测到 TypeScript 7+ 工作区包,工作区提示和版本选择器提供该包,并且扩展选择该编译器时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Needs Investigation

The TypeScript 7 extension finds a workspace's own TypeScript 7 only in node_modules/@typescript/native-preview. That package was last published on 2026-07-07 (7.0.0-dev.20260707.2). TypeScript 7 now ships as typescript: [email protected] came out the next day, and the 7.1 nightlies ship as typescript@next (7.1.0-dev.20260930.4 today). So a project that installs TypeScript 7 the current way runs the extension's bundled compiler instead of its own. Nothing tells the user, and the only fix is to write a tsdk setting by hand.

Versions: TypeScript 7 extension 1.0.1, VS Code 1.140.0, macOS.

Repro
  1. In an empty folder, run npm install -D typescript@next and add main.ts with export const n: number = 1;.
  2. Open the folder in VS Code with the TypeScript 7 extension installed, and open main.ts. No setting is needed: on its first start, the extension turns TypeScript 7 on by itself (it writes "js/ts.experimental.useTsgo": true into the user settings). If TypeScript 7 was turned off later, run TypeScript: Enable TypeScript 7 Language Server.

Expected: the extension offers the workspace's TypeScript, as it does for @typescript/native-preview: the "This workspace has TypeScript 7 installed" prompt, and Use Workspace Version in TypeScript: Select TypeScript Version.

Actual: no prompt, and the server runs the extension's own compiler (7.0.2), not node_modules/typescript (7.1):

…/extensions/typescriptteam.native-preview-1.0.1-darwin-x64/lib/tsc --lsp --stdio

With "js/ts.tsdk.path": "node_modules/typescript", the same project runs the workspace compiler. So only the detection is missing: resolveTsdkPathToExe already accepts a typescript package (bin tsc).

Where

In packages/vscode-typescript/src/session.ts (main at 43521c80), findWorkspaceNativePreviewPackages checks only node_modules/@typescript/native-preview. Both promptUseWorkspaceVersion and the version picker (promptSelectVersion) use it.

Suggestion

Also detect node_modules/typescript when it is TypeScript 7 or newer. pathHasTsserverJs already tells a TypeScript 5 or 6 package apart from a TypeScript 7 one.

Why it matters
  • The editor and the project's tsc (CLI, CI) then run the same compiler.
  • Features that need a 7.1 nightly, such as content mappers with --runExternalCode, now need either the TypeScript 7 Nightly extension or a hand-written tsdk setting. The Nightly extension applies to every workspace and changes daily. The tsdk setting is easy to miss, because the extension never mentions it.
主要语言
Go
星标
111k
派生
15.5k
平均合并
1 天 11 小时
30 天内合并 PR
151

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/TypeScript 的其他 Issue

查看 microsoft/TypeScript 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。