Repository navigation
Type-check gts in the editor with TypeScript 7 - #2255
Draft
NullVoxPopuli-ai-agent wants to merge 14 commits into
Draft
NullVoxPopuli-ai-agent wants to merge 14 commits into
NullVoxPopuli-ai-agent wants to merge 14 commits into
Conversation
|
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
NullVoxPopuli-ai-agent
force-pushed
the
nvp/ts7-editor
branch
from
September 16, 2026 19:17
8944fb3 to
ea4c036
Compare
Contributor
Footnotes
|
NullVoxPopuli-ai-agent
force-pushed
the
nvp/ts7-editor
branch
2 times, most recently
from
September 18, 2026 11:11
9daee88 to
63e8273
Compare
TypeScript 7 compiled for Go's js/wasm target, so that its language server can run in a browser worker. The wasm is built at publish time from a pinned commit on a fork that adds a JavaScript spawn bridge for content mappers. wasm_exec.js is Go's runtime shim, vendored as is. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pnpm turbo build runs it in CI and before publish, and GitHub's runners have Go, so no workflow needs a Go setup step. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
When the format is gts, the editor starts a worker that runs TypeScript 7 compiled to wasm as a language server, with ember-content-mapper hosted in the same worker for the gts transform. The editor gets the language server plugin from @codemirror/lsp-client, plus a lint source that pulls file diagnostics, because the server only pushes project diagnostics. The wasm comes from esm.sh via @nullvoxpopuli/tsc-wasm. The type declarations for the virtual project are collected from node_modules at build time into ts7-types.json, so they always match the app's ember-source and Glint versions. The worker is built as its own bundle by the vite plugin. Vite's own worker support runs the app's close hooks for the worker bundle, which made the SSG plugin look for index.html before it existed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The vite plugin copies tsc.wasm from @nullvoxpopuli/tsc-wasm into dist in parts under 25 MiB, because Cloudflare Pages caps one asset at that size, and writes a manifest next to them. The worker fetches the parts in parallel and joins them before compiling. The esm.sh URL, the version define, and the test-time override are gone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The worker had its own in-memory file system, filled from a JSON of declaration files that the vite plugin collected at build time. The REPL already has a file system, with the packages a snippet imports installed under `/node_modules`, and the checker can read that one. repl-sdk grows `nodeFs(storage)`: the storage, served the way Go's wasm runtime reads files. Links are followed, an overlay holds what only the checker sees (the tsconfig, and the open document ahead of the compile), and it is read-only because the fs worker is the writer. The type packages become ordinary installs. The client puts them in storage through `installer.ensure` at the app's own versions, and links them when nothing is linked yet, so a snippet's unversioned imports and the checker agree on what `ember-source` means. The content mapper reads the versions from the same place. Storage now caches directory handles. A project load reads several hundred declaration files, and every step of a path walk was a round trip. The first diagnostics went from about 4 seconds to about 2 after the worker starts. The LSP client's request timeout goes up to cover that first load. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Only the worker serves Go's `globalThis.fs`, so the adapter lives next to it instead of in repl-sdk. repl-sdk keeps the storage reads it needed (`readBytes`, `stat`, `entries`), which describe storage, not Go. Its tests move with it and run in Chrome against the real origin private file system, the same one the worker reads. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Without `experimentalDecorators`, TypeScript treats `@tracked` as a standard decorator and hands it a context object its signature does not accept, which reported TS1240 on every tracked property. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
TypeScript fences the signatures in its hover and completion documentation as `typescript`. The client only highlights a fence whose language is the editor's own, so the signatures rendered as plain text. The client now gets the JavaScript and TypeScript languages for those fences, and the colors come from the editor's highlight style. The theme gives the documentation a code background, the editor's monospace font, and paragraph spacing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The CodeMirror LSP client rendered Markdown with its own copy of marked, synchronously, and highlighted code fences with the editor's grammar only. The app already has remark, rehype, and Shiki in a worker for its documents. A pnpm patch gives the client a `renderMarkdown` option that may be asynchronous. Hover content is rendered before the tooltip is created, completion documentation resolves through the autocompletion info promise, and signature documentation lands when it is ready. marked is gone from the client and from the bundle. The app renders the Markdown with remark-parse, remark-rehype, the Shiki worker plugin, and rehype-stringify. Raw HTML is dropped on the way, because the text comes from the type declarations of packages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The REPL already has an md compiler, configured by the app with its remark and rehype plugins and the Shiki worker. The documentation from the language server goes through it now, as `documentation.md`, and the tooltip takes the rendered HTML. No second Markdown pipeline. The client needs the compiler for that, so the editor modifier passes the compiler service's compiler along. The HTML is sanitized with DOMPurify on the way in, because the text comes from the type declarations of packages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The md compiler puts its HTML in a template literal and escaped only
backticks. A document with `${title}` in a code block threw "title is
not defined" when its module was evaluated, and a backslash sequence
like `\n` turned into the character it names. Hovering `Component` in
the editor hit this, because its documentation has an example with
`${title} ${lastName}`.
Backslashes, backticks, and `${` are escaped now. A browser test
covers the three, and the editor gets a hover test that goes through
the language server, the md compiler, and the tooltip.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The markdown compiler turned `{{` in code into `\{{` for every
document. Only glimdown needs that, because its HTML becomes a Glimmer
template. An md document showed the backslash, and so did the
documentation in the editor's tooltips.
The parser takes a `glimmer` option now, and glimdown passes it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The tooltip showed paragraphs with no room between them, headings and lists as plain lines, and grew as tall as the page. The theme gives the documentation paragraph spacing, headings, bullets, a scrollable height, and a wider column. Hovering before the language server was ready showed nothing, and the hover had to be repeated once it was. Until the server is ready, a hover now shows where the loading is at, and the mouse position is kept. When the server arrives, the editor hovers again on its own. Tests share one page and one language server, so a test can forget the server and start it afresh. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The compiler knows more than one flavor of hbs and refuses a fence that does not say which, so documentation with an hbs example did not render at all. The tooltip's markdown now tags every hbs fence as Ember's, the way the glimdown format does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
nvp/ts7-editor
branch
from
September 18, 2026 20:41
334f1b6 to
006705c
Compare
NullVoxPopuli-ai-agent
changed the base branch from
main
to
nvp/storage-reads
September 18, 2026 20:41
NullVoxPopuli
marked this pull request as draft
September 18, 2026 20:54
This branch has not been deployed
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.
Builds on #2254. When the format is
gts, the editor starts a worker that runs TypeScript 7 (compiled to wasm) as a language server and shows its diagnostics inline. The template errors map back to the gts source through ember-content-mapper, which runs inside the same worker.How it fits together:
node-fs.jsnext to the worker serves that storage the way Go's wasm runtime reads files: links followed, read-only, with an overlay for what only the checker sees (the tsconfig, and the open document ahead of the compile). repl-sdk only gained the storage reads it needed:readBytes,stat, andentries. The project root is/, and the document is/src/index.gts, the same file the compiler writes.ember-source,@glimmer/component,@glint/template,@glint/ember-tsc,ember-content-mapper) are ordinary installs. The client puts them in storage throughinstaller.ensureat the app's own versions, which the vite plugin passes in as a define. A package that is already linked keeps its link, so a snippet's unversioned imports and the checker agree on what a name means. The content mapper reads the installed versions from storage.app/templates/edit/editor/typescript/holds the worker, the browser build of ember-content-mapper's request handlers, and the CodeMirror client. The client attaches through a compartment in the codemirror modifier, so switching away from gts removes it.config/vite-ts7.mjsbuilds the worker as its own bundle. Vite's worker support runs the app's close hooks for the worker bundle, which broke the SSG step.textDocument/diagnosticthrough a lint source. TypeScript 7 only pushes project diagnostics, and@codemirror/lsp-clientonly listens for pushes.client/registerCapabilityandworkspace/configurationrequests itself, because the CodeMirror client rejects them and that aborted the server's initialization.Costs on the first gts document: the wasm is 48 MB, shipped with the app in three parts under 25 MiB (Cloudflare Pages caps one asset at that size) and about 11 MB over the wire once compressed, plus the type packages from npm, which stay in storage across visits. The worker bundle is 390 KB. Nothing loads for other formats. On a warm visit, diagnostics appear about 5 seconds after the page loads, of which the project load is about 2 seconds.
Limits in this version:
gjsis not wired up yet. Packages a snippet installs after the checker started are not seen until the page reloads, because the client does not send file watch notifications.Merge order
Stacked on #2276 (the repl-sdk storage reads this needs) and #2254 (the wasm package, whose
buildscript builds the wasm in CI). The base is #2276's branch, so #2254's two commits show here until it merges. Merge #2276 and #2254 in either order, then this.Verified locally with the wasm built from the workspace package: the full Chrome suite passes, repl-sdk's node and browser suites pass, and lint and the type checks pass.
🤖 Generated with Claude Code