Repository navigation
Enable synchronous API connections to existing servers - #64175
Jake Bailey (jakebailey) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The Unix client retains nonblocking FIFO descriptors, adding polling latency to synchronous requests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds synchronous API connections to existing standalone and LSP servers using FIFOs on Unix and named pipes on Windows.
Changes:
- Adds selectable stdio, socket, and synchronous transports.
- Extends clients and VS Code integration with synchronous sessions.
- Adds cross-platform connection and cleanup tests.
File summaries
| File | Description |
|---|---|
tsc/internal/lsp/server.go |
Creates async or synchronous API sessions. |
tsc/internal/lsp/lsproto/lsp_generated.go |
Adds the synchronous request option. |
tsc/internal/lsp/lsproto/_generate/generate.mts |
Generates the new protocol field. |
tsc/internal/ipc/transport.go |
Adds cancellable transport acceptance. |
tsc/internal/ipc/transport_windows.go |
Uses named pipes for sync transport. |
tsc/internal/ipc/transport_unix.go |
Implements FIFO transport and cleanup. |
tsc/internal/api/server.go |
Generalizes server transport selection. |
tsc/cmd/tsc/api.go |
Adds the --transport option. |
packages/vscode-typescript/src/session.ts |
Forwards synchronous session requests. |
packages/vscode-typescript/src/extension.ts |
Exposes synchronous connection selection. |
packages/vscode-typescript/src/client.ts |
Sends the synchronous protocol field. |
packages/typescript/test/sync/connection.test.ts |
Tests standalone and LSP sync connections. |
packages/typescript/src/api/syncChannel.ts |
Connects sync channels to existing servers. |
packages/typescript/src/api/sync/client.ts |
Enables socket-style sync clients. |
packages/typescript/src/api/sync/api.ts |
Updates generated sync API documentation. |
packages/typescript/src/api/options.ts |
Documents transport-specific pipe behavior. |
packages/typescript/src/api/async/api.ts |
Updates connection documentation. |
Review details
Files not reviewed (1)
- tsc/internal/lsp/lsproto/lsp_generated.go: Generated file
- Files reviewed: 16/17 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
77311ad to
23a1f25
Compare
Allow the synchronous JavaScript API to attach to standalone and LSP-hosted API sessions without spawning another compiler process. Use FIFO pairs on Unix and named pipes on Windows, with cancellable setup and cleanup.
23a1f25 to
599a189
Compare
Nonblocking FIFO probes introduce polling delays into synchronous API requests. Client I/O should wait for responses without that latency, while server I/O remains cancellable during shutdown.
There was a problem hiding this comment.
🟡 Changes recommended
The Unix readiness marker can let the LSP server unlink FIFO paths before the client opens its final descriptors.
1 open finding
2 resolved since last review
Files not reviewed (1)
- tsc/internal/lsp/lsproto/lsp_generated.go: Generated file
🧠 Review effort: Balanced
The LSP server removes FIFO paths as soon as it accepts a connection. Signaling readiness too early lets that cleanup race with the client's final descriptor opens, causing intermittent connection failures.
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-platform FIFO and named-pipe lifecycle behavior warrants final human validation.
0 open findings
1 resolved since last review
Files not reviewed (1)
- tsc/internal/lsp/lsproto/lsp_generated.go: Generated file
🧠 Review effort: Balanced



This is some work I had back on the old repo that I've now brought back up to date.
Right now, you can only open an async connection with an existing server process. But, we can provide the sync API if we use FIFOs/named pipes; such a thing is not possible from Node as it irritatingly does not have
mkfifoor anything, but we can just do that on the Go side and then the API can talk to that instead, which to that process just looks like stdio.