.foo files contain TSX; mapper.mjs is a 47-line identity content mapper that returns them unchanged as .tsx (one verbatim span, all features). No framework, Volar, or tsserver plugin is involved.
Verified with [email protected], the TypeScript 7 extension 1.0.1, VS Code 1.140.0, and Node.js 24.18.0 on macOS 26.6.2 x64.
npm install --ignore-scripts
npm run setup # writes node_modules/identity-foo-mapper/package.json pointing at mapper.mjsnpm run askask.mjs sends tsc --lsp the request the extension sends when > is typed (textDocument/_vs_onAutoInsert), right after <b> in card.foo and in control.tsx (same text: export const card = <div><b></div>;):
card.foo: {"_vs_textEditFormat":2,"_vs_textEdit":{"range":{"start":{"line":0,"character":28},"end":{"line":0,"character":28}},"newText":"$0</b>"}}
control.tsx: {"_vs_textEditFormat":2,"_vs_textEdit":{"range":{"start":{"line":0,"character":28},"end":{"line":0,"character":28}},"newText":"$0</b>"}}
Open this folder in VS Code with the TypeScript 7 extension, "js/ts.experimental.useTsgo": true, and "js/ts.tsdk.path" pointing at this folder's node_modules/typescript (the 7.1 nightly; the extension's bundled 7.0.2 has no content mappers). Trust the workspace.
| File | Hover on card |
Type <b> between <div> and </div> |
|---|---|---|
type-here.tsx |
const card: any |
<div><b></b></div> |
type-here.foo |
const card: any |
<div><b></div>, no closing tag |
With the server log at its default verbosity, typing in type-here.tsx produces one textDocument/_vs_onAutoInsert request; typing in type-here.foo produces none, although the extension sends hover, diagnostic, code action, inlay hint and semantic token requests for that file.