From c5c92c7ff970576dcdb850d7719b3405647997a4 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Tue, 4 Aug 2026 08:54:33 +0200 Subject: [PATCH 1/2] fix: truncate completion results --- server/index.mjs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/server/index.mjs b/server/index.mjs index 66112967..32a8bc7c 100755 --- a/server/index.mjs +++ b/server/index.mjs @@ -451,6 +451,26 @@ wss.addListener('connection', async function (ws, req) { return message }) serverConnection.forward(socketConnection, (message) => { + // WORKAROUND: cut the number of completion results sent to the client since a search like `a` + // would send ~40MB of completions completely blocking slow connections + // This should probably be addressed in the LSP server instead, although the exact form + // of the desired change is unclear + const maxCompletions = 100 + const completionResult = message['result'] + if ( + completionResult && + // TODO: The client request sends a `"method"` named `textDocument/completion` (or apparently `completionItem/resolve`) + // how do we reliably catch the right response? Do we need to track request ids? + completionResult['isIncomplete'] !== undefined && + completionResult['items'] !== undefined + ) { + completionResult['items'] = completionResult['items'].slice( + 0, + maxCompletions, + ) + completionResult['isIncomplete'] = true + } + const prefix = isDevelopment ? PROJECTS_BASE_PATH : '' FilenamesToUri(prefix, message) if (isDevelopment && !isGithubAction) { From 6ac263e9e02c16a4cdbb0e97a95c1d899d193050 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Wed, 26 Aug 2026 20:45:30 +0200 Subject: [PATCH 2/2] fix --- server/index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/index.mjs b/server/index.mjs index 32a8bc7c..e5ea35dd 100755 --- a/server/index.mjs +++ b/server/index.mjs @@ -455,7 +455,9 @@ wss.addListener('connection', async function (ws, req) { // would send ~40MB of completions completely blocking slow connections // This should probably be addressed in the LSP server instead, although the exact form // of the desired change is unclear - const maxCompletions = 100 + // note: the completion always sends *all* tactics and only filters them client-side, so this + // number must be higher than the total number of tactics, 227 by the looks. + const maxCompletions = 300 const completionResult = message['result'] if ( completionResult &&