Fix TypeScript 7 workspace package detection - #64567
Nanditha264 wants to merge 2 commits into
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
|
Nanditha264 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The changed workspace detection behavior lacks direct regression coverage.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds TypeScript 7 workspace package detection to the VS Code extension while retaining legacy package support.
Changes:
- Detects standard and legacy TypeScript 7 packages.
- Filters out packages containing
tsserver.js. - Extends package-resolution fixtures.
| File | Description |
|---|---|
packages/vscode-typescript/src/session.ts |
Adds workspace package candidates and detection filtering. |
packages/vscode-typescript/src/util.ts |
Exports the existing tsserver.js check. |
packages/vscode-typescript/test/tsdkPackage.test.ts |
Adds legacy package-resolution coverage. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| testResolution("resolves the @typescript/native-preview package", { | ||
| packagePath: "node_modules/@typescript/native-preview", | ||
| platformPath: `node_modules/@typescript/${nativePlatformPackage}`, | ||
| platformPackage: nativePlatformPackage, | ||
| exeName: nativeExeName, | ||
| }); |

Summary
Fix workspace TypeScript detection in the VS Code extension for TypeScript 7 packages.
Previously, the extension only checked for the legacy
@typescript/native-previewpackage when detecting a TypeScript 7 workspace installation. Current TypeScript 7 releases use the standardtypescriptpackage instead.This change:
node_modules/typescript.@typescript/native-previewpackage.pathHasTsserverJscheck to avoid treating TypeScript 5/6 packages as TypeScript 7.resolveTsdkPathToExeresolution logic.Testing
npm test -w native-previewnpm run extension:buildnpx dprint check packages/vscode-typescript/src/session.ts packages/vscode-typescript/src/tsdkPackage.ts packages/vscode-typescript/src/util.ts packages/vscode-typescript/test/tsdkPackage.test.tsAll checks pass.