diff options
author | Veetaha <[email protected]> | 2020-08-08 19:53:38 +0100 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-08-08 19:53:38 +0100 |
commit | e43811c1645f78818d5d7fe0054b54a462145847 (patch) | |
tree | 43c7e67da3e783af3f06033478d306a2cfc99490 /editors/code/src | |
parent | a69f19a6a5899bdfb6fc498371650bf54263deff (diff) |
Fix no inlay hints / unresolved tokens until manual edit
No we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/util.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 970fedb37..49d2d1c6f 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts | |||
@@ -64,7 +64,8 @@ export async function sendRequestWithRetry<TParam, TRet>( | |||
64 | param: TParam, | 64 | param: TParam, |
65 | token?: vscode.CancellationToken, | 65 | token?: vscode.CancellationToken, |
66 | ): Promise<TRet> { | 66 | ): Promise<TRet> { |
67 | for (const delay of [2, 4, 6, 8, 10, null]) { | 67 | // The sequence is `10 * (2 ** (2 * n))` where n is 1, 2, 3... |
68 | for (const delay of [40, 160, 640, 2560, 10240, null]) { | ||
68 | try { | 69 | try { |
69 | return await (token | 70 | return await (token |
70 | ? client.sendRequest(reqType, param, token) | 71 | ? client.sendRequest(reqType, param, token) |
@@ -84,8 +85,7 @@ export async function sendRequestWithRetry<TParam, TRet>( | |||
84 | log.warn("LSP request failed", { method: reqType.method, param, error }); | 85 | log.warn("LSP request failed", { method: reqType.method, param, error }); |
85 | throw error; | 86 | throw error; |
86 | } | 87 | } |
87 | 88 | await sleep(delay); | |
88 | await sleep(10 * (1 << delay)); | ||
89 | } | 89 | } |
90 | } | 90 | } |
91 | throw 'unreachable'; | 91 | throw 'unreachable'; |