Repository navigation
Native TypeScript 7 support for .tsrx through a content mapper (#41) - #135
Merged
Merged
Conversation
…rt (#41) - pin the TypeScript 7 nightly platform packages (7.1.0-dev.20260918.1) at the repository root so the native tsc binary is available without a bin conflict - add the packages/content-mapper skeleton with the consumer parity fixture, the classic tsrx-tsc reference (expected-diagnostics.json) and a test that verifies it - inventory every mapping site by mapping_data variant (MAPPING.md) - delete the dead suppressedDiagnostics plumbing: no transform in this repo or in Ripple ever produced it Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…se 1) - @tsrx/typescript-plugin: factor the type-only transform into a pure transform_tsrx() (src/transform.js) with no Volar types; language.js and the mapper both consume it. Export require_tsrx_compiler/get_tsrx_compiler. - @tsrx/content-mapper: stdio JSON-RPC server (initialize/openProject/ transform/closeProject), Volar mapping → span map conversion (Verbatim/Atom/ Alias, feature bits, disjoint generated spans), embedded <script> bodies as supplemental outputs, compile errors as mapper diagnostics with an export stub fallback, dynamicConfig identity/watchedFiles, option validation and a documented compiler precedence rule (entry options > tsrx.compiler > auto-detect). - Tests: unit tests for span mappings, the export stub and the mapper; native tsc --runExternalCode integration tests against the React consumer fixture, per-target fixtures for Preact, Solid, Vue and Ripple with classic/native diagnostic parity, and a third-party stub compiler that proves Alias spans show authored identifiers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tsc (#41, Phase 2) - declaration emit: Component.d.tsrx.ts + maps, supplemental <script> declarations as .mts modules, generics preserved, consumption of the emitted declarations from a separate project with TypeScript 5 and 7 without the mapper (allowArbitraryExtensions) - incremental: no-op second run, re-check on .tsrx edits, config-identity invalidation when the tsconfig chain changes, file add/delete/rename - --build with project references: the referencing project declares the mapper too so .tsrx inputs redirect to the library's declaration output; the composite + supplemental <script> TS6307 limitation is pinned - --watch: initial compilation asserted; the nightly never recompiles on edit on macOS (plain projects too), documented as an upstream limitation - <script> supplemental outputs switch from .ts to .mts (module scope) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
It resolved against a second vite instance, which broke the hono test and website typechecks with conflicting Vite types. The Vue target fixture now borrows vue-jsx-vapor from the Vite Vue plugin's install, and the lockfile is rebuilt from main plus the new entries only. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…able entry (#41, Phase 3) Move the JSON-RPC framing into src/rpc.js and export the mapper, transport and protocol modules, so a host that bundles the mapper (the VS Code extension for inferred projects) can start it from its own entry without the main guard. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ervice-typescript (#41, Phase 3) Add --typescript-backend=<classic|native> (or the typescriptBackend initialization option). On the native backend TypeScript 7 owns every TypeScript feature for .tsrx through @tsrx/content-mapper, so the server only registers the TSRX-owned plugins (snippets, CSS, symbols, auto-insert, CSS-class hover and definition, keyword highlights); the hover, definition and highlight plugins now work without typescript-semantic, and the volar-service-typescript patch is applied lazily on first classic use. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…entMappers (#41, Phase 3) Add the tsrx.typescript.backend setting (auto/classic/native). On the native backend the extension activates the TypeScript 7 extension, registers the bundled @tsrx/content-mapper for inferred projects (disposed on deactivate and re-registered when that extension reloads), skips the built-in TypeScript extension patch and its useTsgo warning, and starts the TSRX language server with typescriptBackend=native. auto picks native when the TypeScript 7 extension is installed and enabled. The extension also activates on onLanguage:tsrx, declares untrustedWorkspaces.supported=false, and prompts for an extension restart when the resolved backend changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…or editor features (#41, Phase 3) Add tests/lsp-client.js and native-lsp.test.js: dynamic .tsrx registration, pull diagnostics, hover, definition, references, document highlights, rename (Verbatim works, Atom returns nothing), auto-import (extending an import works; a new import statement is dropped, microsoft/TypeScript#64119), compile-failure stub, two configured projects, server restart, the runExternalCode trust gate (mapper never spawned without it), and inferred projects through custom/setContentMapperContributions. Coalesce neighbouring Verbatim spans across identical gaps so a whole import statement is one edit-safe span (this is what makes the auto-import edit applicable), and drop partial-identifier Atom spans such as the file-start anchor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…, Phase 3) Checking the Ripple playground with native tsc surfaced a TS1003 in virtual code: the Ripple compiler copies <script> bodies into the JSX of the element, so a '<' inside one (1 < 2) parses as a tag. The classic path only hid it because Volar drops unmapped diagnostics. Blank the body in the shared transform (same length, line breaks kept); it is checked as the embedded script / supplemental output. The consumer fixture now carries such a body so the parity, native tsc and LSP tests cover it. Record the Ripple playground parity result in the README for the Phase 4 compatibility matrix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…hase 3) Document the classic and native TypeScript backends for Zed, Neovim, JetBrains IDEs and Sublime Text (which gains a README), stating per editor what is verified in this repository and what the editor can run today. The Neovim plugin gains a typescript_backend setup option that starts the TSRX server with --typescript-backend=native and registers the tsrx filetype and runExternalCode with nvim-lspconfig's tsc (TypeScript 7) config. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…sults (#41, Phase 4) - bench/bench.js measures cold and warm (--incremental) checks, single-edit latency through the language servers, peak process-tree RSS and process counts for tsrx-tsc/TSRX server (classic) against tsc --runExternalCode and tsc --lsp (native) on the same tsconfig, with repeated runs - tests/lsp-client.js can drive any stdio server (the classic TSRX server for push diagnostics), exposes the pid, notification listeners and extra text-document capabilities - BENCHMARKS.md records the method and five-run results for the consumer fixture (x1, x25, x100) and the Ripple playground; raw reports under bench/results/2026-09-18-macos-x64/ - the scaled fixture includes every copied importer; bench/ is typechecked Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…path (#41, Phase 4) Every observed classic-versus-native difference classified as compiler-version, previously hidden, adapter bug (fixed), adapter design, upstream limitation or client requirement, with the pinning test or probe per row, plus the surfaces not exercised yet and the upstream items to file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…backend decision (#41, Phase 4) ROLLOUT.md is the release note for the first native TypeScript 7 release: what ships per package, the default-backend decision (classic for the CLI and language server, auto for VS Code) with the criteria for flipping it, migration steps for the CLI, VS Code and other editors, and rollback per surface. The content-mapper README's Phase 3 compatibility notes are replaced by pointers to COMPATIBILITY.md, BENCHMARKS.md and ROLLOUT.md; the language-server and VS Code READMEs and the three changesets link to them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Stub re-exports drop type-only
- The compile-failure stub now reprints exportKind and per-specifier type flags so type-only re-exports stay type-only.
- ✅ Fixed: Reopen drops last-good stub
- openProject now carries last-good source ASTs across the same project handle so a still-broken file keeps its export stub after reopen.
Or push these changes by commenting:
@cursor push 320ed20df9
Preview (320ed20df9)
diff --git a/packages/content-mapper/src/export-stub.js b/packages/content-mapper/src/export-stub.js
--- a/packages/content-mapper/src/export-stub.js
+++ b/packages/content-mapper/src/export-stub.js
@@ -25,8 +25,11 @@
for (const statement of program?.body ?? []) {
switch (statement.type) {
case 'ExportAllDeclaration': {
+ const type = is_type_export(statement) ? ' type' : '';
const exported = statement.exported ? ` as ${export_name(statement.exported)}` : '';
- lines.push(`export *${exported} from ${JSON.stringify(String(statement.source.value))};`);
+ lines.push(
+ `export${type} *${exported} from ${JSON.stringify(String(statement.source.value))};`,
+ );
break;
}
case 'ExportDefaultDeclaration':
@@ -34,13 +37,15 @@
break;
case 'ExportNamedDeclaration': {
if (statement.source) {
+ const declaration_is_type = is_type_export(statement);
const specifiers = statement.specifiers.map((specifier) => {
const local = export_name(specifier.local);
const exported = export_name(specifier.exported);
- return local === exported ? local : `${local} as ${exported}`;
+ const type = !declaration_is_type && is_type_export(specifier) ? 'type ' : '';
+ return local === exported ? `${type}${local}` : `${type}${local} as ${exported}`;
});
lines.push(
- `export { ${specifiers.join(', ')} } from ${JSON.stringify(String(statement.source.value))};`,
+ `export${declaration_is_type ? ' type' : ''} { ${specifiers.join(', ')} } from ${JSON.stringify(String(statement.source.value))};`,
);
break;
}
@@ -77,6 +82,14 @@
}
/**
+ * @param {object} node
+ * @returns {boolean}
+ */
+function is_type_export(node) {
+ return /** @type {{ exportKind?: string }} */ (node).exportKind === 'type';
+}
+
+/**
* @param {AST.Identifier | AST.Literal | AST.Expression} node
* @returns {string}
*/
diff --git a/packages/content-mapper/src/mapper.js b/packages/content-mapper/src/mapper.js
--- a/packages/content-mapper/src/mapper.js
+++ b/packages/content-mapper/src/mapper.js
@@ -87,7 +87,15 @@
// (installed compilers, package manifests) may be stale.
invalidateCompilerResolutionCaches();
const { options, optionDiagnostics } = validate_options(params.options);
- const state = create_project_state(params.configFileName || undefined, options);
+ // Reopen keeps last-good source ASTs so a file that is still failing to
+ // compile continues to emit its export stub after tsconfig or compiler
+ // identity changes.
+ const previous = projects.get(params.projectHandle);
+ const state = create_project_state(
+ params.configFileName || undefined,
+ options,
+ previous?.lastGood,
+ );
projects.set(params.projectHandle, state);
// Resolve the compiler once up front so the tsconfig chain and the
@@ -220,14 +228,15 @@
/**
* @param {string | undefined} config_file_name
* @param {MapperOptions} options
+ * @param {Map<string, AST.Program>} [last_good]
* @returns {ProjectState}
*/
- function create_project_state(config_file_name, options) {
+ function create_project_state(config_file_name, options, last_good) {
return {
configFileName: config_file_name ? path.normalize(config_file_name) : undefined,
options,
dependencies: new Set(),
- lastGood: new Map(),
+ lastGood: last_good ?? new Map(),
};
}
diff --git a/packages/content-mapper/tests/export-stub.test.js b/packages/content-mapper/tests/export-stub.test.js
--- a/packages/content-mapper/tests/export-stub.test.js
+++ b/packages/content-mapper/tests/export-stub.test.js
@@ -44,4 +44,19 @@
expect(text).toContain(`export { x, y as z } from "./c.tsrx";`);
expect(text).toContain('declare const _default: any;\nexport default _default;');
});
+
+ it('keeps type-only re-exports as type-only', () => {
+ const text = stub(`
+export type { Foo, Bar as Baz } from './types.tsrx';
+export { type Qux, value } from './mixed.tsrx';
+export type * from './all-types.tsrx';
+export type * as ns from './ns.tsrx';
+`);
+ expect(text).toContain(`export type { Foo, Bar as Baz } from "./types.tsrx";`);
+ expect(text).toContain(`export { type Qux, value } from "./mixed.tsrx";`);
+ expect(text).toContain(`export type * from "./all-types.tsrx";`);
+ expect(text).toContain(`export type * as ns from "./ns.tsrx";`);
+ expect(text).not.toMatch(/export \{ Foo/);
+ expect(text).not.toMatch(/export \* from "\.\/all-types/);
+ });
});
diff --git a/packages/content-mapper/tests/mapper.test.js b/packages/content-mapper/tests/mapper.test.js
--- a/packages/content-mapper/tests/mapper.test.js
+++ b/packages/content-mapper/tests/mapper.test.js
@@ -192,6 +192,28 @@
expect(first.text).toBe('export {};\n');
});
+ it('keeps the last-good export stub after TypeScript reopens the project', () => {
+ const mapper = create_tsrx_content_mapper();
+ const config = path.join(consumer_fixture_dir, 'tsconfig.json');
+ const open = () =>
+ mapper.openProject({
+ configFileName: config,
+ projectHandle: 'p1',
+ compilerOptions: {},
+ });
+ open();
+ const file = path.join(consumer_fixture_dir, 'Panel.tsrx');
+ mapper.transform({ fileName: file, content: fixture('Panel.tsrx'), projectHandle: 'p1' });
+ const broken = fixture('Panel.tsrx').replace('{label}', '{{{label}');
+ const before = mapper.transform({ fileName: file, content: broken, projectHandle: 'p1' });
+ expect(before.text).toContain('export declare const PanelProps: any;');
+ open();
+ const after = mapper.transform({ fileName: file, content: broken, projectHandle: 'p1' });
+ expect(after.text).toBe(before.text);
+ expect(after.diagnostics).toHaveLength(1);
+ expect(after.diagnostics?.[0].code).toBe(DIAGNOSTIC_CODE_COMPILE_ERROR);
+ });
+
it('reports an unresolvable declared compiler as a diagnostic instead of throwing', () => {
// Inside this monorepo a packaged compiler is always discoverable, so the
// "no compiler at all" branch cannot be reached here; an explicit butYou can send follow-ups to the cloud agent here.
…-failure stub (#41) `export type { A } from`, `export type * from` and `export { type A } from` were re-emitted as value re-exports, so the stub for a file that already failed to compile could raise its own diagnostics under isolatedModules or verbatimModuleSyntax and importers could lose type-only names. The stub now reads the ESTree-TS exportKind on the statement and on each specifier. Review finding on #135 by Cursor Bugbot. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
) openProject created a fresh lastGood map per project state, so after TypeScript reopened a project (watched tsconfig or compiler manifest change) a .tsrx file that still failed to compile got an empty export stub and its importers lost the preserved export surface. The last-good ASTs are keyed by file name and independent of the project, so they now live at the mapper level and survive reopens with the same or a new handle, and close/reopen. Review finding on #135 by Cursor Bugbot. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…-watch (#41) Both items in the "upstream issues still to file" list are now filed on microsoft/TypeScript after checking for existing reports and workarounds: - #64350: composite projects report TS6307 for the supplemental <script> output. Reproduced with a dependency-free mapper; no `include` glob or `files` entry can name the virtual file and referenced projects must be composite, so there is no configuration workaround. - #64351: `tsc --watch` never recompiles on macOS. Reproduced without a mapper and bisected across the nightlies to the 7.1.0-dev.20260811.1 build; `--watchFile` strategies, directory casing, symlinks and stdin state make no difference, so it is distinct from #64089. The README, COMPATIBILITY.md, ROLLOUT.md and the two pinning tests now reference the issues instead of "not filed yet". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
11 tasks
…ipt 7 package (#41) The classic path (tsrx-tsc, the tsserver plugin, the TSRX language server) passes its whole test suite on TypeScript 6.0.3, so the `typescript` peer range becomes `^5.9.3 || ^6.0.0`. The `typescript@7` package is a launcher for the native binary without a JavaScript API: tsrx-tsc, the language server and @tsrx/content-mapper now stop with an explanation (and a pointer to the tracking issue #136) instead of failing on its export map, and the mapper declares the JavaScript TypeScript it needs for tsconfig parsing as its own dependency so a TypeScript 7 project needs nothing extra. The mapper's minimum TypeScript build is `7.1.0-dev.20260822.1`, found by running the native test suite across the nightlies (`7.1.0-dev.20260821.1` rejects `--runExternalCode`, `typescript@7.0.2` has no content-mapper protocol at all); `TSRX_NATIVE_TSC` runs the suite against another build. VS Code: the TypeScript 7 extension is looked up under the ids VS Code's own TypeScript extension uses (adding `TypeScriptTeam.native-preview`) and every installed one is tried for `registerContentMappers`, because the nightly channel is a compiler-only companion. The TypeScript 7 warnings now state what the native backend needs, say that support is not complete, link the tracking issue and offer to open it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…matrix (#41) Resolution: `paths` aliases, a `.tsx` importer and a workspace package behind a `node_modules` symlink, checked against classic `tsrx-tsc` on the same workspace. Build: a chain of mapper-backed composite projects. Editors: inlay hints with every hint enabled (through `workspace/configuration`), the formatting registration TypeScript 7 makes for `.tsrx` (no edits, so Prettier must stay the `[tsrx]` default formatter), the third-party compiler under the language server, and the built TSRX server driven over stdio on both backends for CSS completion, hover, class definition, document symbols and diagnostics ownership. Lifecycle: deleting and renaming `.tsrx` files during a native session. The LSP test client answers `workspace/configuration`, advertises file watching and can report watched-file changes. `COMPATIBILITY.md` gains rows 37 to 50 and a shorter "not yet exercised" list. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`pnpm format:check` failed on the untracked `packages/intellij-plugin/.intellijPlatform/**` files the plugin build generates; nothing in there is source. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…the rollout notes (#41) llms.txt and the getting-started page gain a "Type checking" section: the classic `tsrx-tsc` path on TypeScript 5.9 or 6, the native path through `@tsrx/content-mapper` on a TypeScript 7.1 nightly (`7.1.0-dev.20260822.1` or newer) with `contentMappers` and `tsc --runExternalCode`, the VS Code `tsrx.typescript.backend` setting, and the tracking issue #136. ROLLOUT.md records what is true on 2026-09-19: the stable 7.0 line has no content-mapper protocol, no marketplace release of the TypeScript 7 extension exposes `registerContentMappers` yet, packaging is verified on macOS (tarball with npm and `typescript@7` outside the checkout; the VSIX's bundled mapper), the migration installs `typescript@next`, and Prettier must be the `[tsrx]` default formatter. BENCHMARKS.md adds the mapper's start-up breakdown (a third of the ~600 ms floor is TypeScript's JavaScript API). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ted code An error's directive spanned from the first to the last generated offset of the node that holds it. A <script> body is checked as a block at the end of the generated file, and the React target hoists static elements above the component, so for an element holding a script body the range covered every component in between and hid their TypeScript errors. Each run of the node's segments now gets its own range, ending where code mapped from outside the node follows. Reported by Bugbot on #135. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t to do when none can The TypeScript 7 extension 1.0.1 runs its bundled tsc 7.0.2, which cannot run the content mapper, and VS Code's own TypeScript steps aside while TypeScript 7 is on, so .tsrx files got no TypeScript features and nothing said why. Neither Microsoft extension shows its version item on .tsrx files. - A language status item on .tsrx files names the TypeScript that serves them and opens the version picker, or a list of fixes. - A notice, once per window and situation, with "Don't Show Again" per workspace: install the TypeScript 7 extension for a project on a 7.1 nightly; use the project's TypeScript, install TypeScript 7 Nightly or turn TypeScript 7 off when TypeScript 7 runs a compiler that cannot check .tsrx files; install the TypeScript 7 extension when only the Nightly extension, which only adds a compiler, is installed. - typescript-7.js works out the compiler the way the TypeScript 7 extension does (tsdk settings, then the Nightly extension, then its bundled one); closing-tags.js shares its TypeScript 7 check. Editor scenarios check the status and the notices, and two click a notice button: Open Setting opens the Settings editor, and Turn Off TypeScript 7 hands the open .tsrx file to VS Code's TypeScript without a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each scenario's VS Code came to the front, so nothing else could be done while the tests ran. On macOS the runner now starts each instance with `open -n -g -j -W`, but VS Code brings its first window to the front itself, so a small Swift helper (hide-test-windows.swift, compiled with swiftc per run) hides any test instance the moment macOS reports it active, which gives the front back. Measured over a full run, the test window was in front about 0.1 s per scenario; without swiftc the runner falls back to polling, with a few seconds in front. `open` hands the app its own environment, so the runner passes the cleaned one and PATH (the content mapper runs node). Typing in the checks is now an edit at the cursor: the `type` command needs a window with the focus. `--foreground` keeps the old visible launch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…next The TypeScript 7 extension runs its built-in tsc 7.0.2, which cannot run the content mapper, and it finds a workspace compiler only in the retired @typescript/native-preview package (microsoft/TypeScript#64565). Editor tests show that two user settings make it run the project's 7.1 nightly with nothing to click: "js/ts.experimental.useTsgo": true, "js/ts.tsdk.path": "node_modules/typescript" The relative path resolves per project; a project on TypeScript 5.9 or without typescript falls back, and VS Code's own TypeScript is not affected when TypeScript 7 is off. The extension README, ROLLOUT.md, the website and llms.txt now give the same three steps (install typescript@next, add the two settings, install the TypeScript 7 extension) and no longer recommend the TypeScript 7 Nightly extension; #991 tracks simplifying them. The README drops the notices section. The notices no longer offer the Nightly extension: a project without 7.1 is told to install typescript@next, one with 7.1 to set js/ts.tsdk.path. The editor scenarios are rebuilt around this setup (17, all passing), including a TypeScript 5.9 project (`projectTypeScript: 'classic'`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s ask once The settings also work in a project's .vscode/settings.json, where the TypeScript 7 extension asks once before it uses the project's TypeScript. That belongs next to the settings, not in the closing note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… when its tsdk changes The 7.0.2 notice told people to open the js/ts.tsdk.path setting and type a path. In practice the value went into the Settings search box, and even a saved value changed nothing: the TypeScript 7 extension reads its tsdk settings only when it starts. - A Use Project TypeScript button writes the setting. When the open folder installs a 7.1 nightly, it writes "node_modules/typescript" to the user settings (the README's setting, no prompt); when only a subfolder does, or the workspace already has a tsdk setting, it writes the workspace settings. - When a tsdk setting change alters the compiler TypeScript 7 should run, the extension restarts it: its server for a user setting, the extension host for a workspace one, since only its start-up asks to allow a workspace setting. Hand edits need no reload either. - The README says the notice can add the setting. The editor scenario ts7-bundled-use-project-typescript clicks the button: TypeScript 7 then serves the .tsrx file through the project's 7.1. All 17 scenarios pass. The runner also stops a still-exiting instance before deleting its temporary directory, which failed with ENOTEMPTY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was no way to restart the TSRX language server from the Command Palette. The new command restarts it together with the TypeScript server that serves .tsrx files: VS Code's own tsserver (typescript.restartTsServer) with TypeScript 7 off, TypeScript 7 (typescript.native-preview.restart) with it on. It skips the TypeScript restart when no TypeScript server runs, and is registered before the server starts, so it can retry a server that failed to start. The status item's fix list offers it too, and the README has a Restarting section. Editor scenarios can now run a command at the end; vscode-typescript-restart and ts7-recommended-restart check that TypeScript answers again and the TSRX server lists document symbols after the restart. Closes #829 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… editor tests The fixture now has main.ts, which imports App.tsrx, which imports label.ts. Its tsconfig.json has no `plugins` entry. Every scenario where TypeScript serves the .tsrx file now checks both imports. All 20 scenarios pass, so VS Code needs no tsconfig `plugins` entry on TypeScript 5.9, 6 or 7.1. - run.js turns on the tsserver log and records each tsserver's version and whether it loaded @tsrx/typescript-plugin (`result.tsserver`). - New scenario vscode-typescript-classic-project: js/ts.tsdk.path points at the project's TypeScript 5.9 lib folder, and the check confirms 5.9.3 runs. - The closing-tag check reads from the position where it typed, so the formatted three-line <button> does not matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ngs note - Rewrite the text after the setup steps in short sentences, with headings, lists, and links for the upstream issues. - Correct the "server plugins will not be loaded" warning: quote its real text, say that it comes from the extension's typescriptServerPlugins entry (not from tsconfig.json), that it shows each time VS Code starts until Don't Show Again, and link microsoft/TypeScript#64356. - New "Legacy settings" section: VS Code no longer needs the tsconfig `plugins` entry for @tsrx/typescript-plugin (only other editors do). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #135 is about to merge, so the gaps and upstream issues are tracked in the reopened issue #136 again. TYPESCRIPT_7_TRACKING_URL (used by the tsrx-tsc, language-server and VS Code messages), the editor and package READMEs, ROLLOUT.md, the website, llms.txt and the changeset now link it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tsserver's findSourceDefinition failed for a library symbol in a .tsrx file: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 4 To find the JavaScript behind a .d.ts file, tsserver adds the file to a helper project (an AuxiliaryProject with noDtsResolution) and loads no plugins into it, so that project read the .tsrx file as plain TypeScript while the host project had registered it as TSX. The plugin now gives the helper project the host project's Volar setup before tsserver builds it. VS Code's typescript.tsserverRequest forwards only a few built-in requests and those whose name starts with `_`, so the plugin also registers `_tsrx:findSourceDefinition`, which runs the session's findSourceDefinition. A test drives a real tsserver with the plugin as a global plugin, as VS Code loads it; verified on TypeScript 5.9.3 and 6.0.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… .tsrx files TSRX: Go to Source Definition used to run Go to Definition and prefer a .tsrx result. VS Code's own command and the TypeScript 7 extension's run only in TypeScript and JavaScript files. Now, with VS Code's own TypeScript (5.9 or 6), the command sends @tsrx/typescript-plugin's `_tsrx:findSourceDefinition` through typescript.tsserverRequest: `useState` opens React's JavaScript instead of @types/react. With TypeScript 7 it opens the definition and says why the first time: tsc --lsp answers the request for .tsrx files, but the TypeScript 7 extension's command refuses them (microsoft/TypeScript#64576). The TYPESCRIPT_7_SOURCE_DEFINITION flag hands over once that ships (#992). Both paths open results with editor.action.goToLocations and an explicit file and position, so they work without the editor focus. The editor tests now run the command on `useState` in every setup where TypeScript works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server now answers textDocument/formatting on every backend with the project's own prettier and @tsrx/prettier-plugin (src/formatting.js, no Volar import; src/formattingHandler.js on the plain LSP connection, since Volar formats only generated code, never the .tsrx source). - Both packages come from the node_modules folders above the file, never NODE_PATH. The plugin and the tsrx parser are always passed, so a .tsrx file formats even when the Prettier config does not list the plugin. - The Prettier config, .editorconfig and the nearest .prettierignore apply as on the command line; the editor's indentation only when the project has neither a config nor an .editorconfig. - A missing package or a Prettier older than 3.6 returns no edits and sends window/showMessage once per project, with the install command for the project's package manager (nearest lockfile). A file Prettier cannot parse is only logged. tsrx.format.enable: false turns it off. - No Volar service plugin offers formatting (servicePlugins.test.js): one would make Volar replace this handler. README: Formatting section, pnpm commands, GitHub links between packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g user settings
configurationDefaults now set "[tsrx]": { "editor.defaultFormatter":
"TSRX.tsrx-vscode-plugin" }, so Format Document and format on save use the
language server's Prettier formatting and the Prettier extension is not
needed. configurePrettier() is gone: on every start it wrote
prettier.documentSelectors and the whole [tsrx] block into the user
settings, replacing any other [tsrx] settings and selectors. The unused
tsrx.preferences.preferTypeOnlyAutoImports setting is removed, and
tsrx.format.enable now controls the formatter.
Editor tests: every scenario formats a messy Format.tsrx written into the
project copy (no Prettier extension installed) and checks the default
formatter. The formatted text is computed from the edits, never applied:
an unsaved document made VS Code ask to save it at shutdown, and that
dialog brought the hidden window to the front. Scenarios now fail if any
document is left unsaved. All 20 pass.
README: Formatting section, and the Prettier settings older versions wrote
under Legacy settings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ands - @tsrx/prettier-plugin README: a Usage section (install, Prettier config, command line, editors through the TSRX language server). - IntelliJ README: formatting through the language server needs prettier and @tsrx/prettier-plugin in the project. - content-mapper ROLLOUT.md: nothing to set for formatting in VS Code. - Package READMEs link other packages with GitHub URLs: npm and the marketplace show each README alone, where ../other-package breaks. - Install and run commands show a pnpm line next to the npm one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… files The server now also answers textDocument/rangeFormatting with the project's Prettier and @tsrx/prettier-plugin (rangeStart/rangeEnd), so Format Selection and editor.formatOnPaste work. Before, VS Code said that TSRX "can only format 'TSRX'-files as a whole". The editor tests check Format Selection on one line of the messy Format.tsrx in every scenario. READMEs: VS Code says that Format Document With… also lists TypeScript for .tsrx files, which cannot format them (microsoft/TypeScript#64579); Neovim, Sublime Text and Zed get a Formatting section (Neovim: vim.lsp.buf.format({ name = "tsrx" }) next to TypeScript 7's tsc client). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Config plugin name skips resolved path
- format_tsrx now drops a bare @tsrx/prettier-plugin config entry and passes the plugin path already resolved from the file, so Prettier no longer re-resolves the name from its own cwd when the packages live in different node_modules trees.
Or push these changes by commenting:
@cursor push b77c7d6d1e
Preview (b77c7d6d1e)
diff --git a/.changeset/language-server-prettier-plugin-path.md b/.changeset/language-server-prettier-plugin-path.md
new file mode 100644
--- /dev/null
+++ b/.changeset/language-server-prettier-plugin-path.md
@@ -1,0 +1,5 @@
+---
+'@tsrx/language-server': patch
+---
+
+Editor formatting of `.tsrx` files still works when the Prettier config lists `@tsrx/prettier-plugin` by package name and that plugin is installed in a different `node_modules` than Prettier. The language server passes the plugin path it resolved from the file, instead of leaving Prettier to load the bare name from its own working directory.
diff --git a/packages/language-server/src/formatting.js b/packages/language-server/src/formatting.js
--- a/packages/language-server/src/formatting.js
+++ b/packages/language-server/src/formatting.js
@@ -87,9 +87,14 @@
tabWidth: tab_size,
useTabs: !insert_spaces,
};
+ // A config entry of `@tsrx/prettier-plugin` is not the copy `resolve` found.
+ // Prettier loads that bare name from its own cwd, which misses a plugin
+ // installed in another `node_modules` than Prettier (a nested package).
/** @type {unknown[]} */
- const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];
- if (!plugins.includes(PRETTIER_PLUGIN)) plugins.push(plugin_entry);
+ const plugins = (Array.isArray(config.plugins) ? config.plugins : []).filter(
+ (plugin) => plugin !== PRETTIER_PLUGIN,
+ );
+ if (!plugins.includes(plugin_entry)) plugins.push(plugin_entry);
const formatted = await prettier.format(text, {
...config,
filepath: file_path,
diff --git a/packages/language-server/tests/formatting.test.js b/packages/language-server/tests/formatting.test.js
--- a/packages/language-server/tests/formatting.test.js
+++ b/packages/language-server/tests/formatting.test.js
@@ -76,6 +76,43 @@
}
});
+ it('uses the plugin resolved from the file when the config names it and the packages are in different node_modules', async () => {
+ const dir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'tsrx-format-')));
+ projects.push(dir);
+ const app = path.join(dir, 'packages', 'app');
+ fs.mkdirSync(path.join(app, 'src'), { recursive: true });
+ const file_path = path.join(app, 'src', 'App.tsrx');
+ fs.writeFileSync(file_path, MESSY);
+ fs.writeFileSync(
+ path.join(app, '.prettierrc'),
+ JSON.stringify({ singleQuote: true, tabWidth: 4, plugins: ['@tsrx/prettier-plugin'] }),
+ );
+ // Prettier at the workspace root, the plugin only in the nested package.
+ const prettier_link = path.join(dir, 'node_modules', 'prettier');
+ fs.mkdirSync(path.dirname(prettier_link), { recursive: true });
+ fs.symlinkSync(prettier_package, prettier_link, 'junction');
+ const plugin_link = path.join(app, 'node_modules', '@tsrx', 'prettier-plugin');
+ fs.mkdirSync(path.dirname(plugin_link), { recursive: true });
+ fs.symlinkSync(plugin_package, plugin_link, 'junction');
+
+ const previous = process.cwd();
+ try {
+ // Prettier resolves a bare plugin name from here, not from the file.
+ process.chdir(dir);
+ expect(await format_tsrx({ file_path, text: MESSY, insert_spaces: false })).toEqual({
+ status: 'formatted',
+ text: `import { useState } from 'react';
+export function App() @{
+ const [count, setCount] = useState(0);
+ <button onClick={() => setCount(count + 1)}>{count}</button>
+}
+`,
+ });
+ } finally {
+ process.chdir(previous);
+ }
+ });
+
it('reads .editorconfig', async () => {
const { file_path } = project({
files: { '.editorconfig': '[*.tsrx]\nindent_style = space\nindent_size = 3\n' },You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit bdcc301. Configure here.
…move Unused Imports for .tsrx files VS Code's own TypeScript commands only run in TypeScript and JavaScript files, so the menu entries that added them for .tsrx files never appeared or refused the file: - typescript.reloadProjects and typescript.goToProjectConfig: hidden, because typescript.isManagedFile is false in .tsrx editors (VS Code's editor tracker counts TypeScript and JavaScript only). - typescript.findAllFileReferences: shown in the Explorer and editor-tab menus, then "Unsupported file type" (#993 tracks a real command; TypeScript 7 has none yet, microsoft/TypeScript#63806). - typescript.sortImports and removeUnusedImports: no edits on 5.9/6 (#994), and missing commands while TypeScript 7 is on. Instead: - TSRX: Go to Project Configuration opens the nearest tsconfig.json above the file, where TSRX reads its settings. - TSRX: Sort Imports and TSRX: Remove Unused Imports fetch TypeScript's source action through vscode.executeCodeActionProvider and apply it (editor.action.sourceAction acts on the focused editor only). They work on TypeScript 7. - TSRX: Restart Language Server covers Reload Projects; TSRX's commands appear in the Command Palette of a TSRX workspace (tsrx.active). Editor tests: Go to Project Configuration in every setup, Remove Unused Imports on a runtime-written Imports.tsrx (removed on TypeScript 7, unchanged on 5.9/6 until #994), reverted afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 2 tasks
…w to turn it on - The editor tests ask VS Code's linked editing provider (the auto-rename of a tag pair) for the <button> tag in App.tsrx: both tag names on VS Code's own TypeScript and on TypeScript 7 (#827). - README: turn on editor.linkedEditing (VS Code leaves it off for every language), everywhere or only for [tsrx]. - Go to Source Definition's step waits until TypeScript returns a definition: on TypeScript 7 the fallback sometimes ran before the definition's file had loaded and opened nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the formatted file
When the Prettier config listed @tsrx/prettier-plugin (or another plugin)
by package name, format_tsrx passed the name through, and Prettier resolved
it from the process's working directory. For an editor's language server
that is not the project, so in a monorepo with Prettier at the root and the
plugin in a package, formatting failed ("Cannot find package
'@tsrx/prettier-plugin' imported from …/noop.js") and returned no edits.
Plugins named by package now resolve from the node_modules folders above
the file, as the Prettier extension resolves them relative to the document;
@tsrx/prettier-plugin becomes the entry format_tsrx already resolved. A name
that is not installed stays for Prettier to report. The regression test runs
the formatter from an unrelated working directory.
Found by Cursor Bugbot on #135.
Co-Authored-By: Claude Opus 5.5 <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.


Implements #41, Phases 0–4, one commit per task, plus the follow-ups of 2026-09-19 listed at the end (the summary below reflects the branch as it stands; earlier states are in the commit history).
Closes #827, closes #829.
Summary
@tsrx/content-mapper(new): a TypeScript 7 content mapper so nativetsc --runExternalCodeandtsc --lsptype-check.tsrxfiles with the same target-specific type-only transform astsrx-tsc. Spans areVerbatim/Alias/Atomwith feature bits;<script>bodies are blocks inside the generated TSX (no supplemental outputs); every TSRX compile error is aTSRX<code>diagnostic at its authored position, with anignoredirective that hides TypeScript's own copy of the mistake; a file that fails to compile is replaced by an export stub so importers keep resolving.dynamicConfigwith a hashedconfigIdentityand watched files.@tsrx/typescript-plugin: the transform is factored intosrc/transform.jsand shared by every path;<script>bodies are blanked in the JSX text (fixes a TS1003 that the classic path silently dropped when a body contains<) and appended to the generated TSX as block statements with mappings,importdeclarations of<script type="module">bodies hoisted to module level, so tsserver, the language server and the mapper all type-check them in place; the tsserver plugin drops TypeScript's diagnostics for a file while it has a fatal TSRX compile error; deadsuppressedDiagnosticsplumbing removed.tsrx-tscfollows the installed TypeScript: on a 7.1 nightly with the content-mapper protocol it runs the native binary with--runExternalCodeand refuses a tsconfig without a.tsrxmapper; a TypeScript 7 build without the protocol is explained.@tsrx/language-server:--typescript-backend=<classic|native|plugin>/typescriptBackendinit option. Onnativethe server serves only what TypeScript 7 does not own;pluginis the same slim set plus TSRX compile errors, for editors whose own tsserver serves.tsrxthrough the plugin;volar-service-typescriptis loaded lazily and only onclassic; atypescript.tsdkinit option names the TypeScript to host onclassic. Default staysclassic..tsrxthrough an available content-mapper API, leaving server selection to Microsoft. VS Code's own TypeScript serves.tsrxfiles: its tsserver through@tsrx/typescript-plugin, contributed viatypescriptServerPlugins(withlanguages: ["tsrx"], so VS Code manages.tsrxdocuments and its own TypeScript commands and menus work on them) and shipped in the VSIX, or TypeScript 7 through the content mapper declared intsconfig.jsonwhen TypeScript 7 is selected. The TSRX server always runs slim (pluginmode); its compile-error copy is dropped once the mapper has been seen reporting in the session, so compile errors show once either way. Activates on a single.tsrxfile; declaresuntrustedWorkspaces.supported: false.setup(plugin, { typescript_backend })), IntelliJ and Sublime Text.packages/content-mapper/:BENCHMARKS.md(harnessbench/bench.js, raw reports underbench/results/),COMPATIBILITY.md(36 classified rows with evidence),ROLLOUT.md(release notes, migration, rollback, default-backend decision).Native is 2.1–3.6× faster on cold checks, 3.3–4× faster edit-to-diagnostics and uses 25–45% less peak memory than the classic path on the same projects, with one extra Node mapper process per
tscinvocation or language-server session.Default-backend decision (
ROLLOUT.md): CLI docs keeptsrx-tsc, which is classic on TypeScript 5.9/6 and native on TypeScript 7; language server defaults toclassicfor other editors; VS Code has no default to pick, it follows the TypeScript VS Code runs. The classic path stays for as long as TypeScript 5.9/6 are supported; no deprecation is planned.tsrx-tscworks with every supported version, and TypeScript 7 can also runtsc --runExternalCodedirectly.Validation
pnpm test --project content-mapper --project typescript-plugin --project language-server --project vscode-plugin: 779 tests greenpnpm typecheckgreen (includingpackages/content-mapper/bench/)pnpm changeset:checkgreen; eleven changesets:minorfor@tsrx/typescript-plugin(with its fixed group),@tsrx/language-serverand@tsrx/vscode-plugin,patchfor@tsrx/coreand@tsrx/content-mapperplayground/ripplein the Ripple repo, 1,648-lineApp.tsrx) report identical diagnostics on both paths; a stub third-party compiler is covered throughtsrx.compilerand mapper options7.1.0-dev.20260930.4(catalog:native), and the minimum is7.1.0-dev.20260923.1; macOS x64 only so farFollow-ups
Needed before flipping any default (tracked in
COMPATIBILITY.mdandROLLOUT.md):Atomspans returns nothingComponent.d.tsrx.ts(consumers without the mapper needallowArbitraryExtensions).tsrximports on TypeScript 7 (./CardforCard.tsrx,Card.web.tsrxthroughmoduleSuffixes;./Card.tsrxworks today). Tracked together:7.1.0-dev.20260929.1, including with--runExternalCode,allowArbitraryExtensions, andallowImportingTsExtensions; standalone reproduction.contentMappersfor extensionless specifiers, after every built-in extension (.ts,.tsx,.d.ts,.js,.jsx) and only in modes that already add extensions. Includes a prototype patch against TypeScript main and a test matrix. On its own it resolves./CardtoCard.tsrxeven withmoduleSuffixes: [".web", ""]; platform variants also need Content mappers: amoduleSuffixeslist on acontentMappersentry microsoft/TypeScript#64560.moduleSuffixesprobescard.foo.webinstead ofcard.web.foofor a registered extension microsoft/TypeScript#64548: labeled Working as Intended (2026-09-30). ThemoduleSuffixescompiler option puts the suffix after a registered extension by design, so./Card.tsrxwith[".web", ""]probesCard.tsrx.webinstead ofCard.web.tsrx; reproduction.moduleSuffixeslist on acontentMappersentry microsoft/TypeScript#64560 (suggestion, filed 2026-09-30): an optionalmoduleSuffixeslist on acontentMappersentry, used instead of the compiler option for that entry's extensions, with the suffix placed before the extension (./Card.tsrx→Card.web.tsrx). Entries without it, and the compiler option, resolve as today. Includes a prototype against TypeScript main and a results table.7.1.0-dev.20260929.1: a.tsre-export per variant (Card.web.tsre-exporting./Card.web.tsrx), or generated.d.tsre-exports in a hidden folder merged in withrootDirs, both with themoduleSuffixescompiler option..tsrximports on TypeScript 5.9/6 through Volar'sresolveHiddenExtensions.Aliasspans (cosmetic; no bundled compiler emits obfuscated identifiers today)Upstream issues filed (2026-09-19, both verified first: no existing report, no config or mapper-side workaround):
--build) projects for the compiler-named supplemental<script>output. Reproduced with a 30-line standalone mapper;includeglobs never match the virtual file,filesgives TS6053, and referenced projects must be composite. No longer affects TSRX since 4bb54b2:<script>bodies are blocks in the generated TSX and there is no supplemental output;native-build.test.jsnow type-checks a<script>body inside a referenced composite library.--watchnever recompiled on macOS. Reproduced on a plain.tsproject without a mapper and bisected across the nightlies: last good7.1.0-dev.20260810.1, first bad7.1.0-dev.20260811.1(8 upstream commits in the window). Every--watchFilestrategy, directory casing, symlinks and stdin state made no difference, so it is distinct from FSEvents watcher drops events when requested casing differs from disk casing microsoft/TypeScript#64089. Fixed upstream by Fix case sensitivity fswatch and users microsoft/TypeScript#64210 (merged 2026-09-22), first shipped in7.1.0-dev.20260923.1. Verified on 2026-09-30 with the TSRX mapper:--watchrecompiles after both.tsrxand.tsedits on7.1.0-dev.20260923.1and7.1.0-dev.20260930.4, it still never recompiles on7.1.0-dev.20260922.1, and the whole content-mapper suite passes on both fixed builds. Closed upstream with those results on 2026-09-30.tsc --build --watchrecompiles after an edit to a file the tsconfig lists (includeglobs match.tsrxonce the mapper is declared), but not after an edit to a file that is only imported. TypeScript 6.0.3 behaves the same for plain.tsfiles (a standalone probe with an identity.foomapper and plain.tscontrols). It surfaced only because the consumer fixture lists justmain.ts.Validation gaps (
COMPATIBILITY.md, "Not yet exercised"):pathsaliases, monorepo symlinks beyond the junctioned test workspaces,.tsximporters of.tsrxmodules.tsrxnow that TypeScript 7 registerstextDocument/formatting(it returns no edits; Prettier must keep winning); CSS features in<style>on the native backend in a real editor; third-party compiler fixture under the language server.tsrxfiles during a native session; more than one mapper-backed project in onetsc --buildgraph@tsrx/content-mappertarball and the VSIX outside the checkout; still open on Linux and Windows (only macOS x64 has been run); CI has no TypeScript 7 platform package for other OSes yetDocs and process:
website-tsrx/public/llms.txt: documentcontentMappers,tsc --runExternalCode, the VS Code setting and the per-editor native setup (not touched in this PR)contentMappersinplayground/ripple/tsconfig.jsonand excludedebug/(the stale generated dump there is the only diagnostic on both paths); ship a Ripple-side guide now that@tsrx/content-mapper@0.1.0is published (2026-09-20)pnpm format:checkfails locally only on untrackedpackages/intellij-plugin/.intellijPlatform/**sandbox files; consider ignoring that directory in.prettierignoreFollow-ups done on 2026-09-19 (commits 2b43b24 … 74e5854)
7.1.0-dev.20260822.1(bisected across the nightlies with the newTSRX_NATIVE_TSCoverride); stabletypescript@7.0.2has no content-mapper protocol (TS5023 for--runExternalCode). No 7.1 beta or RC exists yet.typescriptpeer range is^5.9.3 || ^6.0.0.tsrx-tscand the classic language server explain thetypescript@7package (a launcher without a JavaScript API) instead of failing on its export map.extendsrules, resolve-pkg-maps), the mapper has notypescriptdependency and starts ~3× faster, the language server's native backend runs on Volar's plain project host; both are tested with thetypescriptpackage forbidden.VS Code: no marketplace release of the TypeScript 7 extension supports content mappers yet (TypeScript 7Resolved on 2026-09-30: the marketplace TypeScript 7 extension (TypeScriptTeam.native-previewstopped at0.20260708.2, before the feature; the TypeScript 7 Nightly extension is compiler-only); until TypeScript 7.1 and its extension ship, it takes a build ofpackages/vscode-typescriptfrom microsoft/TypeScript (the typescript-go staging repository is closed).TypeScriptTeam.native-preview) jumped to1.0.1. Its VSIX has theregisterContentMappers(id, [{ extensions }])API the TSRX extension probes for (same signature as the source build), plus thejs/ts.contentMappers.enabledsetting, so a from-source build is no longer needed. Its bundled compiler, though, istsc7.0.2, which has no content-mapper protocol. It picks the compiler in this order: ajs/ts.tsdk.pathsetting (a workspace-level one only in a trusted workspace after Use Workspace Version), then the TypeScript 7 Nightly extension (TypeScriptTeam.vscode-typescript-nightly, a 7.1 nightly binary with no code of its own) if installed, then the bundled 7.0.2. So.tsrxfiles need either the Nightly extension or a workspacetypescript7.1 nightly selected with TypeScript: Select TypeScript Version. Checked in the package; the editor check is in progress.tsrx-tscruns on TypeScript 7 (aba93df): when the installedtypescriptis a 7.1 nightly with the content-mapper protocol, the wrapper resolves the launcher's@typescript/typescript-<os>-<arch>package the waylib/getExePath.jsdoes and runs the native binary with--runExternalCode(after the arguments in--buildmode, first otherwise), so onepackage.jsonscript serves TypeScript 5.9, 6 and 7. It reads the tsconfig files the invocation would use through the plugin's ownextends-aware reader (in--buildmode every compiling project of thereferencesgraph, solution configs skipped; a config that does not parse is left totsc, f49b583) and refuses to run one without a.tsrxcontent mapper (TypeScript would silently skip those files and importers would get TS2307);contentMappersis not a CLI option and does inherit throughextends, both verified against the pinned binary. Stable 7.0 and nightlies before7.1.0-dev.20260822.1are still explained.@tsrx/content-mapperis an optional peer of the plugin. Covered bytsc.test.js(stub launcher plus a recording platform binary) and the newtsrx-tsc-native.test.js(end to end on the pinned binary, classic diagnostics required); 423 tests green across content-mapper, typescript-plugin, language-server and vscode-plugin, pluspnpm typecheck,format:checkandchangeset:check.debug/dump excluded, the playground shows 30 pre-existing diagnostics on both paths (identical apart from one duplicate-Vite-types TS2320 on native); the exclude is an uncommitted change in the Ripple checkout, andcontentMapperscan be adopted now that@tsrx/content-mapper@0.1.0is published (2026-09-20).Follow-ups done on 2026-09-19, later (commits 6df042f … 4bb54b2)
tsrx.typescript.backendsetting, the tsdk resolution and the runtime patch of the built-in TypeScript extension are gone. Instead the extension contributes@tsrx/typescript-pluginthrough VS Code'stypescriptServerPluginspoint (enableForWorkspaceTypeScriptVersions,languages: ["tsrx"]) and ships it in the VSIX, so VS Code's own tsserver serves.tsrxfiles, whichever TypeScript it runs (its bundled copy or the workspace version), manages.tsrxdocuments itself, and resolves.tsrximports from.tsfiles with no tsconfigpluginsentry. With TypeScript 7 selected, TypeScript 7 serves them through the content mapper. The TSRX server always runs in the new slimpluginmode and reports TSRX compile errors; the extension drops that copy once the mapper has been seen reporting in the session. Verified in isolated VS Code 1.138 instances (own user-data and extensions directories, the TypeScript 7 extension built from microsoft/TypeScript with the pinned 7.1 nightly embedded) on VS Code's bundled 6.0.3 with no settings, the workspace 5.9.3 and 6.0.3 versions, and the 7.1 nightly: diagnostics inside.tsrx, TypeScript and CSS-selector hover from one provider, the importer's cross-file error, definition into.tsrx, one TSRX compile error, and a type error inside a<script>body at its source position.<script>bodies are type-checked on every path (4bb54b2): blocks in the generated TSX instead of extra service scripts (which Volar's tsserver-plugin path does not support) and supplemental.mtsoutputs. This also lifts the composite-project TS6307 limitation and removes the*.tsrx.<n>.d.mtsdeclaration files. Script-body declarations are no longer document symbols on any path.tsrx.typescript.backendandjs/ts.experimental.useTsgoare not read any more. The two menu context keys the extension used to set are VS Code's own. (Since 2026-09-30 the extension readsjs/ts.experimental.useTsgoagain, only to close tags on TypeScript 7 and to say which TypeScript serves.tsrxfiles; see the last section.)@typescript/native-preview(the retired preview package) is gone;pnpm typecheckruns the pinned TypeScript 7.1 platform binary throughscripts/native-tsc.js(the roottypescriptlauncher when it is TypeScript 7, the pinned binary otherwise); tsdown is on 0.23 with byte-identical bundles.compilerOptions.pluginswith@tsrx/typescript-plugin; VS Code needs nothing; TypeScript 7 needscontentMapperseverywhere. The TypeScript 7 extension's one-time warning about the TSRX tsserver plugin is explained as harmless..tsrxfiles apply no edits.Error reporting on TypeScript 7 (2026-09-30, commits 14af950 … 95e5614)
Main is merged in (455fc88).
Each mistake shows once. The generated code can lose a mistake the parser records with a TypeScript code, and then TypeScript never reports it:
On TypeScript 7, 21 such errors were lost this way: modifier order and repeats,
?on a rest or destructured parameter, the comma after a rest element, a decorator on a function. The mapper now sends every compile error, and for each one anignorediagnostic directive (the protocol'sdiagnosticDirectives) over the generated code of the statement, class or type member, or element that holds it. Where TypeScript reports the mistake too, or a follow-on error of a TSRX mistake, its copy stays hidden until the mapper's error is fixed. The ranges come from the compiler'ssourceAstand Volar mappings, so every target compiler gets the same, and the mapper README now says what a compiler has to return.Codes: the source is
TSRX, in capitals like TypeScript's ownTS2322. A TSRX code shows as itself (TSRX2002), a TypeScript code as11and its number (TS1005→TSRX111005), and the mapper's own errors asTSRX771000–TSRX771003.DIAGNOSTIC_SOURCElives in@tsrx/core/diagnosticswith the codes and prefixes; the mapper, the language server and the VS Code extension import it. Both the mapper and the server now use that source, so the extension tells their errors apart by the code's type: the mapper's are numbers, the server's strings.Tests:
packages/content-mapper/tests/error-examples.jshas an example for 133 of the 149 entries in@tsrx/core/diagnostics, and the reason there is none for the other 16. Those are errors only compilers outside this repository raise, and entries no source reaches ([Bug]: tsrx-core: A declare declaration in an ambient namespace misses TS1038, and gets an extra TS1044 beside another modifier #961, [Bug]: tsrx-core: let as a name is TS1212, where TypeScript reports TS1214 in a module, and a let binding's TS2480 is never reported #962, tsrx-core: Five TypeScript-coded error entries have no source that raises them #964, [Bug]: tsrx-core: TSRX2025 says "use server" allows top-level await, but nothing checks the directive #887).error-examples.test.js:Seven don't show exactly once yet.
KNOWN_PROBLEMSrecords each with its issue, and the test fails once one is fixed, so the record can't go stale.third-party-compiler.test.jscovers a compiler the mapper doesn't know, reporting a code TSRX doesn't have.@tsrx/core/diagnosticsruns nothing when it loads, so a bundle keeps only the tables it reads:@__NO_SIDE_EFFECTS__DIAGNOSTIC_CODES, since aDIAGNOSTIC_CODES.Xread keeps the table in Rolldown and esbuild even inside a pure callThe mapper's bundle now takes about 1 KB of the file instead of 45 KB, the extension 553 B and the language server 387 B, with no bundler settings. A test checks that nothing runs on load.
Filed along the way:
tscpass what the build rejectsexport as namespacehave no mapping #979: the keywords ofexport as namespacehave no mappingawaitin an@forbody is reported twice, once with a message outside the error tables #980: Solid and Vue report anawaitin@fortwice@{ … }body also report the first as unused (TSRX2010) #981: two outputs in an@{ … }body also report TSRX2010Validation: the content-mapper, typescript-plugin, language-server and vscode-plugin projects (748 tests) and every
tsrx-*project (5,647 tests) pass; the typecheck of core, content-mapper, language-server and vscode-plugin is clean, and so areformat:checkandchangeset:check.VS Code with the marketplace TypeScript 7 extension, closing tags, and the repository on the 7.1 nightly (2026-09-30 to 10-01, commits b445cd6 … a6dd4ef)
Main is merged in (d282f11, which brings #985 for #983).
The TypeScript 7 extension 1.0.1 left
.tsrxfiles with nothing. The marketplace extension supports content mappers, but it runs its built-intsc7.0.2, which can't run the mapper, and it finds a workspace compiler only innode_modules/@typescript/native-preview, last published on 2026-07-07 (filed as microsoft/TypeScript#64565). Withjs/ts.experimental.useTsgoon (the extension turns it on at its first start), VS Code's own TypeScript steps aside, so nothing checked.tsrxfiles.Setup (extension README, ROLLOUT.md, website, llms.txt; e664dac). Editor tests show these make the TypeScript 7 extension run the project's 7.1 nightly with nothing to click:
npm install -D typescript@next(until TypeScript 7.1 is released)In the VS Code user settings:
{ "js/ts.experimental.useTsgo": true, "js/ts.tsdk.path": "node_modules/typescript" }Install the TypeScript 7 extension.
The relative path resolves per project. A project on TypeScript 5.9, or without
typescript, falls back to the built-in 7.0.2, and VS Code's own TypeScript is unaffected when TypeScript 7 is off. The TypeScript 7 Nightly extension isn't needed and is no longer recommended. Making the TypeScript 7 extension a dependency was ruled out: at its first start it turns TypeScript 7 on for everyone, which would break TypeScript 5.9/6 projects. #991 tracks simplifying the steps once microsoft/TypeScript#64565 is fixed and TypeScript 7.1 ships.Status item and notices (15df53f, e664dac, a3c86f2): a language status item on
.tsrxfiles names the TypeScript that serves them. When a setup leaves.tsrxfiles unchecked, a notice says what to do, once per window:Use Project TypeScript writes the setting:
"js/ts.tsdk.path": "node_modules/typescript"in the user settings when the open folder installs the 7.1 nightly (no prompt), or the subfolder's path in the workspace settings when only a subfolder does. The first version opened the setting for the user to type the path; in practice the path went into the Settings search box, and even a saved value did nothing, because the TypeScript 7 extension reads itstsdksettings only when it starts. So the extension now restarts TypeScript 7 whenever atsdkchange alters the compiler it should run: its server for a user setting, the extension host for a workspace setting (only its start-up asks to allow one). Hand edits need no reload either.A project without 7.1 is told to install
typescript@next; a project on 7.1 without the TypeScript 7 extension is offered Install TypeScript 7; TypeScript 7 on with only the Nightly extension (which only adds a compiler) gets Install TypeScript 7 or Turn Off TypeScript 7. Nothing changes or installs unless a button is clicked. The compiler is worked out the way the TypeScript 7 extension does it (src/typescript-7.js).Closing tags. Typing
<b>before</button>in a.tsrxfile used to rely on the TSRX language server alone, in every setup. Now TypeScript closes it wherever it can:</b>(2e9ad91). TypeScript then reports it (TS17008) as in a half-typed.tsxfile, and its closing-tag request finds the open tag.getJsxClosingTagAtPositioninto the generated code; Volar's language-service proxy leaves that method out (1af8c77). So VS Code's TypeScript 5.9/6 closes tags in.tsrxfiles (js/ts.autoClosingTags.enabled).tsc --lspanswers the closing-tag request through the mapper, but the TypeScript 7 extension only sends it for TypeScript and JavaScript files: filed as TypeScript 7 VS Code extension: closing JSX tags are not inserted in content-mapped files, although tsc --lsp provides them microsoft/TypeScript#64564. Until that ships, the TSRX server closes tags only while TypeScript 7 serves.tsrxfiles, so the two never race (147fa4d).TYPESCRIPT_7_CLOSES_TAGSturns the workaround off; vscode-plugin: remove TSRX's own closing tags once the TypeScript 7 extension closes tags in .tsrx files #989 tracks removing it.@tsrx/coreand@tsrx/typescript-plugin; no Octane test pins the old output.TSRX: Restart Language Server (a6dd4ef, closes #829): the Command Palette had no way to restart the TSRX server. The command restarts it together with the TypeScript server that serves
.tsrxfiles: VS Code's tsserver with TypeScript 7 off, TypeScript 7 with it on. The README has a Restarting section.Editor tests in real VS Code (
pnpm --filter @tsrx/vscode-plugin test:editor): each scenario starts an isolated VS Code (its own user data and extensions directories) on a fixture project. It checks hover, go-to-definition, a type error in the unsaved buffer, closing a typed<b>, the TypeScript status, and the notices; two click a notice button and two run the restart command. On macOS the windows stay out of the way (9865741): VS Code brings its first window to the front even when started hidden, so a small Swift helper hides it the moment macOS reports it active (about 0.1 s per scenario, measured). All 19 scenarios pass:<b>ts7-recommended<b></b>ts7-recommended-tsrx-closing-off<b>(#64564)ts7-recommended-restart<b></b>ts7-recommended-no-project-typescripttypescriptin the project<b></b>typescript@nextts7-recommended-classic-project<b></b>typescript@nextts7-bundledjs/ts.tsdk.path, project on 7.1<b></b>js/ts.tsdk.pathts7-bundled-use-project-typescript<b></b>ts7-bundled-turn-off<b></b>ts7-first-run<b></b>typescript@nextts7-nightly-extension<b></b>ts7-nightly-only<b></b>ts7-off<b></b>vscode-typescript<b></b>vscode-typescript-restart<b></b>vscode-typescript-tsrx-closing-off<b></b>(TypeScript closes it)vscode-typescript-closing-off<b>vscode-typescript-project-ts7<b></b>vscode-typescript-tsdk-ts7-projectjs/ts.tsdk.pathset, project on 7.1<b></b>vscode-typescript-tsdk-classic-projectjs/ts.tsdk.pathset, project on 5.9<b></b>Repository on the TypeScript 7.1 nightly.
typescript@7.1.0-dev.20260930.4(catalog:native) andpnpm typecheckruns itstsc(b445cd6). The Hono tests and the playgrounds are type-checked withtsc --runExternalCodeandcontentMappersinstead oftsrx-tsc(b1f96e2).7.1.0-dev.20260923.1, the first nightly whosetsc --watchrecompiles (b77d26b), and thetypescriptpeer range admits it:^5.9.3 || ^6.0.0 || ^7.1.0-dev.20260923.1(8527a06).pnpm --filter @tsrx/vscode-plugin buildbuilds the workspace packages the extension ships before bundling, sobuild-and-packagenever packs staledist/folders (b790693).tsc --build --watchmissing edits to unlisted files is not a gap: TypeScript 6 behaves the same (2dde250).Bugbot: an error's
ignoredirective spanned from the first to the last generated code of the element holding it. A<script>body is checked at the end of the file, so the range covered every component in between and hid their TypeScript errors. Each piece of the element's generated code now gets its own range (5c7e52c).Validation: the content-mapper, typescript-plugin, language-server and vscode-plugin projects (787 tests) pass; the typecheck of typescript-plugin, content-mapper and vscode-plugin is clean, and so are
format:checkandchangeset:check; all 19 editor scenarios pass in VS Code 1.140.0 on macOS.🤖 Generated with Claude Code
Note
High Risk
Large cross-cutting change to how
.tsrxis type-checked and served in editors (new mapper process, dual backends, VS Code/TS version matrix); regressions could affect diagnostics, LSP features, or CI on all supported TypeScript versions.Overview
Adds native TypeScript 7 support for
.tsrxvia a new@tsrx/content-mapperpackage: TypeScript 7’s content-mapper protocol (tsc --runExternalCode/tsc --lsp) type-checks.tsrxusing the same type-only transform as the classic Volar/tsserver path, with bundleddist/exports, benchmarks, and rollout/compatibility docs.Tooling and editors:
tsrx-tscswitches to nativetscon TS 7.1 nightlies whencontentMappersis configured;@tsrx/language-servergainsclassic/native/pluginbackends (slim TSRX-only features on native/plugin); the VS Code extension activates Microsoft’s TypeScript servers, contributes the tsserver plugin for 5.9/6, registers content mappers for TS 7, adds status/restart/commands, Prettier-based formatting, and coordinated JSX closing-tag behavior.@tsrx/typescript-pluginsharestransform.js, embeds<script>bodies in generated TSX, filters noisy tsserver diagnostics on fatal compile errors, and adds closing-tag / go-to-source-definition fixes.Diagnostics and core: TSRX errors use
TSRXcodes withignoredirectives so each mistake reports once;@tsrx/core/diagnosticsis tree-shakeable; non-code<script type="…">bodies skip TS regions; loose-parser unclosed tags stay unclosed in editor output.Repo: Root
typecheckmoves totscwith the native TS 7 catalog and includes@tsrx/content-mapper; mapper startup no longer depends on loading TypeScript’s JS API.Reviewed by Cursor Bugbot for commit ad24d52. Bugbot is set up for automated code reviews on this repo. Configure here.