about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2023-07-10 23:13:16 +0900
committerTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2023-07-10 23:13:36 +0900
commita66b7e3eba90690ed2860125c7d47932fddaff22 (patch)
tree6a44e22c0d5294523d4530b4f877160dfa8f61da
parentfd31006646b3c9014b1770cf02ab2e9bca59c1e8 (diff)
downloadrust-a66b7e3eba90690ed2860125c7d47932fddaff22.tar.gz
rust-a66b7e3eba90690ed2860125c7d47932fddaff22.zip
editor/code: Remove unused `sendRequestWithRetry`
-rw-r--r--editors/code/src/util.ts36
1 files changed, 0 insertions, 36 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index 688e3873ab4..b6240234aa6 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -1,4 +1,3 @@
-import * as lc from "vscode-languageclient/node";
 import * as vscode from "vscode";
 import { strict as nativeAssert } from "assert";
 import { exec, ExecOptions, spawnSync } from "child_process";
@@ -57,41 +56,6 @@ export const log = new (class {
     }
 })();
 
-export async function sendRequestWithRetry<TParam, TRet>(
-    client: lc.LanguageClient,
-    reqType: lc.RequestType<TParam, TRet, unknown>,
-    param: TParam,
-    token?: vscode.CancellationToken
-): Promise<TRet> {
-    // 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)
-                : client.sendRequest(reqType, param));
-        } catch (error: unknown) {
-            if (delay === null) {
-                log.warn("LSP request timed out", { method: reqType.method, param, error });
-                throw error;
-            }
-
-            if (error instanceof lc.ResponseError) {
-                switch (error.code) {
-                    case lc.LSPErrorCodes.RequestCancelled:
-                        throw error;
-                    case lc.LSPErrorCodes.ContentModified:
-                        await sleep(delay);
-                        continue;
-                }
-            }
-
-            log.warn("LSP request failed", { method: reqType.method, param, error });
-            throw error;
-        }
-    }
-    throw "unreachable";
-}
-
 export function sleep(ms: number) {
     return new Promise((resolve) => setTimeout(resolve, ms));
 }