Merge branch 'master' into add-disable-diagnostics

This commit is contained in:
Igor Aleksanov
2020-08-12 17:26:43 +03:00
134 changed files with 1907 additions and 1282 deletions

View File

@@ -607,7 +607,7 @@
"items": {
"type": "string"
},
"description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.",
"description": "List of warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.",
"default": []
},
"rust-analyzer.analysis.disabledDiagnostics": {

View File

@@ -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) => {
@@ -135,7 +129,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
);
}
} as any
}
};
const client = new lc.LanguageClient(

View File

@@ -64,7 +64,8 @@ export async function sendRequestWithRetry<TParam, TRet>(
param: TParam,
token?: vscode.CancellationToken,
): Promise<TRet> {
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<TParam, TRet>(
log.warn("LSP request failed", { method: reqType.method, param, error });
throw error;
}
await sleep(10 * (1 << delay));
await sleep(delay);
}
}
throw 'unreachable';