Problem
references relies on LanguageServerService, which spawns typescript-language-server --stdio, but the connection is constructed with vscode-jsonrpc IPC readers/writers. This causes the initialize request to never resolve (hang).
Reproduction
From the repo root:
- Install deps
- Build
- Run this repro (4s timeout):
node -e 'const { LanguageServerService } = require("./dist/utils/language_server");
(async()=>{
const svc = new LanguageServerService();
const t = setTimeout(()=>{
console.log("TIMEOUT waiting for initialize (likely transport mismatch)");
try { svc.dispose(); } catch {}
process.exit(0);
}, 4000);
try {
await svc.initialize(process.cwd());
clearTimeout(t);
console.log("initialize resolved (unexpected)");
svc.dispose();
} catch (e) {
clearTimeout(t);
console.log("initialize threw:", e && e.message ? e.message : String(e));
try { svc.dispose(); } catch {}
}
})();'
Expected
initialize resolves quickly (or throws a real error if the server can’t start).
Actual
initialize does not resolve within 4 seconds; the script prints:
TIMEOUT waiting for initialize (likely transport mismatch)
Where in code
src/utils/language_server.ts:
- spawns:
npx typescript-language-server --stdio
- connects via:
new rpc.IPCMessageReader(this.serverProcess) / IPCMessageWriter
Suggested fix
Use stdio stream transport:
- Replace IPC reader/writer with stream reader/writer (e.g.
StreamMessageReader / StreamMessageWriter) wired to serverProcess.stdout and serverProcess.stdin.
Also recommended:
- Handle server start failures and non-zero exit.
- Ensure
dispose() awaits/handles process termination cleanly.
Test plan
- Add a lightweight unit/integration test that asserts
initialize() resolves within a timeout when typescript-language-server is available.
- If keeping this optional, update the command to fail fast with a clear error when the binary isn’t present.
Problem
referencesrelies onLanguageServerService, which spawnstypescript-language-server --stdio, but the connection is constructed withvscode-jsonrpcIPC readers/writers. This causes the initialize request to never resolve (hang).Reproduction
From the repo root:
Expected
initializeresolves quickly (or throws a real error if the server can’t start).Actual
initializedoes not resolve within 4 seconds; the script prints:TIMEOUT waiting for initialize (likely transport mismatch)Where in code
src/utils/language_server.ts:npx typescript-language-server --stdionew rpc.IPCMessageReader(this.serverProcess)/IPCMessageWriterSuggested fix
Use stdio stream transport:
StreamMessageReader/StreamMessageWriter) wired toserverProcess.stdoutandserverProcess.stdin.Also recommended:
dispose()awaits/handles process termination cleanly.Test plan
initialize()resolves within a timeout whentypescript-language-serveris available.