mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Privatize highlighting
This commit is contained in:
parent
cdd7118cbf
commit
233f1dd2a8
8 changed files with 54 additions and 48 deletions
|
@ -62,23 +62,30 @@ export class Ctx {
|
|||
this.extCtx.subscriptions.push(d);
|
||||
}
|
||||
|
||||
async sendRequestWithRetry<R>(method: string, param: any, token: vscode.CancellationToken): Promise<R> {
|
||||
async sendRequestWithRetry<R>(
|
||||
method: string,
|
||||
param: any,
|
||||
token: vscode.CancellationToken,
|
||||
): Promise<R> {
|
||||
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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue