You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeScript 7 VS Code extension: Go to Source Definition does not run in content-mapped files, although tsc --lsp answers for them #64576
In a content-mapped file, TypeScript: Go to Source Definition does nothing, while the same command in a .ts file opens the JavaScript behind a .d.ts file. The language server supports it: custom/textDocument/sourceDefinition for the content-mapped file returns the JavaScript location. The extension never sends that request for content-mapped files.
Repro:https://gist.github.com/leonidaz/d1fcd2d140269282c7df1d3b84fe517f, a 47-line identity content mapper (.foo files contain TSX and are returned unchanged as .tsx) and a JavaScript library greeting with its own index.d.ts. TypeScript 7 extension 1.0.1, typescript@7.1.0-dev.20260930.4 through js/ts.tsdk.path, VS Code 1.140.0, macOS.
if(!["javascript","javascriptreact","typescript","typescriptreact"].includes(document.languageId)){vscode.window.showErrorMessage(vscode.l10n.t("Go to Source Definition failed. Unsupported file type."));return;}
The right-click menu entry has the same four language IDs in its when clause (package.json#L353-L355). The Command Palette entry has no language condition (package.json#L339-L340), so the command is offered in a content-mapped file and then refuses it.
Suggested fix
Let the command accept the documents that selectorScopedDocumentSelector() in client.ts covers: the static selector plus every content-mapper filter, which hover and multi-document highlight already use (client.ts#L356-L387). For example, check vscode.languages.match(selector, document) instead of the language list. The right-click menu would need a matching condition, such as a context key for the content-mapped extensions.
Related: #64564, where on-auto-insert is also registered only for the static JavaScript and TypeScript selector.
Found while adding TypeScript 7 support for .tsrx files through a content mapper (tsrx-org/tsrx#136).
Activity
feat(vscode-plugin): Go to Source Definition goes past .d.ts files in…