From b49508ffe3d34be0520c594bae69e906f22af513 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 10:19:56 +0100 Subject: Fix flickering with new syntax highlighting --- editors/code/src/client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'editors/code/src') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 44bd04c21..1f90af898 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; -import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; export async function createClient(config: Config, serverPath: string): Promise { // '.' Is the fallback if no folder is open @@ -42,6 +42,14 @@ export async function createClient(config: Config, serverPath: string): Promise< rustfmtArgs: config.rustfmtArgs, }, traceOutputChannel, + middleware: { + // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 + async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) { + let res = await next(document, token); + if (res === undefined) throw new Error('busy'); + return res; + } + } as any }; const res = new lc.LanguageClient( -- cgit v1.2.3