From 233f1dd2a850a7c8c6947c88c1ce06f7a945befd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:12:33 +0100 Subject: Privatize highlighting --- editors/code/src/ctx.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'editors/code/src/ctx.ts') diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index d3ef27e43..39eddfcbd 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -62,23 +62,30 @@ export class Ctx { this.extCtx.subscriptions.push(d); } - async sendRequestWithRetry(method: string, param: any, token: vscode.CancellationToken): Promise { + async sendRequestWithRetry( + method: string, + param: any, + token: vscode.CancellationToken, + ): Promise { await this.client.onReady(); for (const delay of [2, 4, 6, 8, 10, null]) { try { return await this.client.sendRequest(method, param, token); } catch (e) { - if (e.code === lc.ErrorCodes.ContentModified && delay !== null) { - await sleep(10 * (1 << delay)) + if ( + e.code === lc.ErrorCodes.ContentModified && + delay !== null + ) { + await sleep(10 * (1 << delay)); continue; } throw e; } } - throw 'unreachable' + throw 'unreachable'; } } export type Cmd = (...args: any[]) => any; -const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) +const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); -- cgit v1.2.3