Skip to content

rx-language-server: find a hoisted TypeScript - #7

Draft
oddcelot wants to merge 2 commits into
zed-rxfrom
zed-rx-tsdk-parents
Draft

oddcelot wants to merge 2 commits into
zed-rxfrom
zed-rx-tsdk-parents

Conversation

@oddcelot

@oddcelot oddcelot commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to solidjs#92.

In a workspace that hoists node_modules to a parent folder, Zed uses the server's bundled TypeScript unless you set settings.typescript.tsdk. The extension can't look there, because Zed only lets an extension read inside the worktree.

So the server does it, in the new src/tsdk.js. When the client sends no tsdk, it walks up from each workspace folder and uses the first node_modules/typescript/lib it finds, stopping at the repository root (the folder with .git). If there's none, it uses its own TypeScript as before. A folder URI it can't turn into a path is skipped, so it can't stop the server from starting. I walk the folders by hand because require.resolve(…, { paths }) also searches global module folders, and could pick up a TypeScript installed on the machine.

The extension still checks the worktree root itself, so nothing changes with the 0.3.1 server on npm. The parent lookup arrives with the next server release. VS Code always sends a tsdk, so it's unaffected.

test/tsdk.js covers it on a temp tree and runs as part of npm test: 11 checks, including a hoisted install, one at the folder, an explicit tsdk, a .git folder or file between the folder and a TypeScript above it, untitled: and file://server/share URIs, and empty workspaceFolders. All pass, and so does node test/run.js (16/16). I haven't tried it inside Zed yet.

Based on zed-rx, so the diff only shows this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant