Add Cmd+Click navigation for tsconfig lib entries#318350
Open
unrevised6419 wants to merge 2 commits into
Open
Conversation
Entries in `compilerOptions.lib[]` now resolve to the matching `lib.<name>.d.ts` file, mirroring the existing document links for `extends`, `files`, and `references`. The target file is picked from the same TypeScript version the language service is using: respects `typescript.tsdk` and the "Use Workspace Version" picker selection, falling back to any locally available TS install and finally the bundled TypeScript. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for navigating from tsconfig.json compilerOptions.lib entries to their corresponding TypeScript lib .d.ts files, using the currently active TypeScript version when possible.
Changes:
- Exported the workspace TSDK storage key so it can be reused outside the version manager.
- Added
compilerOptions.libdocument links and resolution logic (preferring active/local TS versions, then bundled). - Updated extension activation to pass
versionProviderandworkspaceStateinto the tsconfig feature registration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| extensions/typescript-language-features/src/tsServer/versionManager.ts | Exports the workspace TSDK storage key for cross-module use. |
| extensions/typescript-language-features/src/languageFeatures/tsconfig.ts | Adds lib links + resolution via TS versions; updates register signature and open-link handling. |
| extensions/typescript-language-features/src/extension.ts | Passes required dependencies to tsconfig.register. |
| extensions/typescript-language-features/src/extension.browser.ts | Passes required dependencies to tsconfig.register in browser activation. |
- Rename `extendsValue` -> `pathValue` since the field is now used for both `extends` paths and `compilerOptions.lib` values. - Tailor the resolution error message per link type so lib failures say "Failed to resolve TypeScript lib X" instead of "as module". - Detect URI version paths with a scheme regex (excluding Windows drive paths) instead of a naive `://` substring check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds document links for entries in
compilerOptions.lib[]insidetsconfig.json/jsconfig.json, so that Cmd+Click on a value like"DOM"or"ES2020"opens the correspondinglib.<name>.d.tsfile. This mirrors the existing behavior forextends,files, andreferences.The target lib file is resolved from the same TypeScript version the language service is currently using:
typescript.tsdkand the "Use Workspace Version" picker selection — reads the sametypescript.useWorkspaceTsdkworkspace state the version manager writes).node_modules/typescript, configured tsdk).Implementation reuses the existing
_typescript.openExtendsLinkcommand andTsConfigLinkTypeenum (newLibvariant) rather than introducing a parallel command + args type.How to test
tsconfig.jsoncontaining:{ "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ESNext"] } }lib.dom.d.ts,lib.dom.iterable.d.ts,lib.esnext.d.tsopens.🤖 Generated with Claude Code