From 2cd2583f9b7d7958c3553cc216140dee0dad04eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Wed, 17 Jun 2026 18:28:12 +0000 Subject: [PATCH] fix: ignore `hh_client` output during extension init We run `hh_client` once on extension startup before starting the LSP server because `hh_client --lsp` doesn't spawn `hh_server` if it's not running already (https://github.com/facebook/hhvm/issues/8548). This can cause the extension to crash if there are a very large number of errors, as the output of `hh_client` won't fit into `maxBuffer`. Until we fix `hh_client --lsp`, let's simply instruct `hh_client` to return no errors here because we don't actually care about the output. --- src/LSPHackTypeChecker.ts | 2 ++ src/proxy.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/LSPHackTypeChecker.ts b/src/LSPHackTypeChecker.ts index e9701eb..c6f6a57 100644 --- a/src/LSPHackTypeChecker.ts +++ b/src/LSPHackTypeChecker.ts @@ -46,6 +46,8 @@ export class LSPHackTypeChecker { }), ); + // `hh_client --lsp` fails to spawn `hh_server` if not already running, + // so do an initial `hh_client` call to start the server if needed. await vscode.window.withProgress( { location: vscode.ProgressLocation.Window, diff --git a/src/proxy.ts b/src/proxy.ts index 6bfdcbd..469b465 100755 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -19,11 +19,14 @@ export async function version( } } +/** Run `hh_client` to start `hh_server` if needed. */ export async function start( config: HackConfig, log: vscode.LogOutputChannel, ): Promise { - return run(config, log, []); + // Ignore errors to avoid exceeding `maxBuffer` in case of many preexisting errors. + // We only run this command to ensure `hh_server` starts and don't care about the output. + return run(config, log, ["--max-errors", "0"]); } async function run(