From e43811c1645f78818d5d7fe0054b54a462145847 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Aug 2020 21:53:38 +0300 Subject: Fix no inlay hints / unresolved tokens until manual edit No we return ContentModified during the workspace loading. This signifies the language client to retry the operation (i.e. the client will continue polling the server while it returns ContentModified). I believe that there might be cases of overly big projects where the backoff logic we have setup in `sendRequestWithRetry` (which we use for inlay hints) might bail too early (currently the largest retry standby time is 10 seconds). However, I've tried on one of my project with 500+ dependencies and it is still enough. --- editors/code/src/util.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 970fedb37..49d2d1c6f 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -64,7 +64,8 @@ export async function sendRequestWithRetry( param: TParam, token?: vscode.CancellationToken, ): Promise { - for (const delay of [2, 4, 6, 8, 10, null]) { + // The sequence is `10 * (2 ** (2 * n))` where n is 1, 2, 3... + for (const delay of [40, 160, 640, 2560, 10240, null]) { try { return await (token ? client.sendRequest(reqType, param, token) @@ -84,8 +85,7 @@ export async function sendRequestWithRetry( log.warn("LSP request failed", { method: reqType.method, param, error }); throw error; } - - await sleep(10 * (1 << delay)); + await sleep(delay); } } throw 'unreachable'; -- cgit v1.2.3