mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Retry inlay hints on content modified error
This commit is contained in:
parent
08c5d157f9
commit
23bac12062
4 changed files with 22 additions and 17 deletions
|
@ -61,6 +61,21 @@ export class Ctx {
|
|||
pushCleanup(d: { dispose(): any }) {
|
||||
this.extCtx.subscriptions.push(d);
|
||||
}
|
||||
|
||||
async sendRequestWithRetry<R>(method: string, param: any): Promise<R> {
|
||||
await this.client.onReady();
|
||||
const nRetries = 3;
|
||||
for (let triesLeft = nRetries; ; triesLeft--) {
|
||||
try {
|
||||
return await this.client.sendRequest(method, param);
|
||||
} catch (e) {
|
||||
if (e.code === lc.ErrorCodes.ContentModified && triesLeft > 0) {
|
||||
continue;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type Cmd = (...args: any[]) => any;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue