From e43811c1645f78818d5d7fe0054b54a462145847 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Aug 2020 21:53:38 +0300 Subject: 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. --- editors/code/src/util.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code') 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( param: TParam, token?: vscode.CancellationToken, ): Promise { - for (const delay of [2, 4, 6, 8, 10, null]) { + // 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) @@ -84,8 +85,7 @@ export async function sendRequestWithRetry( log.warn("LSP request failed", { method: reqType.method, param, error }); throw error; } - - await sleep(10 * (1 << delay)); + await sleep(delay); } } throw 'unreachable'; -- cgit v1.2.3 From 7252babc136b351d5011a78878607c7aaeea5ed8 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sun, 9 Aug 2020 17:57:27 -0400 Subject: Remove workaround for semantic token flickering See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479 This has been fixed since vscode 1.44 --- editors/code/src/client.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 18948cb3c..bd7a150f0 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -4,7 +4,7 @@ import * as ra from '../src/lsp_ext'; import * as Is from 'vscode-languageclient/lib/utils/is'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; -import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed'; import { assert } from './util'; function renderCommand(cmd: ra.CommandLink) { @@ -44,12 +44,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient diagnosticCollectionName: "rustc", traceOutputChannel, middleware: { - // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 - async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) { - const res = await next(document, token); - if (res === undefined) throw new Error('busy'); - return res; - }, async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) { return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then( (result) => { -- cgit v1.2.3 From 58c97bdcbf6d7df218028f75373cfc4916043693 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sun, 9 Aug 2020 18:09:27 -0400 Subject: Remove 'as any' --- editors/code/src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index bd7a150f0..f5db55b8c 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -129,7 +129,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient ); } - } as any + } }; const client = new lc.LanguageClient( -- cgit v1.2.3 From 8d34262956059aca7e6fded351a9299b3581a5cf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 16:52:28 +0200 Subject: Rename ra_toolchain -> toolchain --- editors/code/src/toolchain.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index 80a7915e9..a5dc3cf0c 100644 --- a/editors/code/src/toolchain.ts +++ b/editors/code/src/toolchain.ts @@ -121,12 +121,12 @@ export class Cargo { } } -/** Mirrors `ra_toolchain::cargo()` implementation */ +/** Mirrors `toolchain::cargo()` implementation */ export function cargoPath(): string { return getPathForExecutable("cargo"); } -/** Mirrors `ra_toolchain::get_path_for_executable()` implementation */ +/** Mirrors `toolchain::get_path_for_executable()` implementation */ export const getPathForExecutable = memoize( // We apply caching to decrease file-system interactions (executableName: "cargo" | "rustc" | "rustup"): string => { -- cgit v1.2.3