Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/util.ts')
| -rw-r--r-- | editors/code/src/util.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index b6b779e266..b6240234aa 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,37 +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) { - if (delay === null) { - log.warn("LSP request timed out", { method: reqType.method, param, error }); - throw error; - } - if (error.code === lc.LSPErrorCodes.RequestCancelled) { - throw error; - } - - if (error.code !== lc.LSPErrorCodes.ContentModified) { - log.warn("LSP request failed", { method: reqType.method, param, error }); - throw error; - } - await sleep(delay); - } - } - throw "unreachable"; -} - export function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } |