about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-02-27 10:19:56 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-02-27 10:19:56 +0100
commitb49508ffe3d34be0520c594bae69e906f22af513 (patch)
treec9a7536741f866ad188818bced993fe7fc88bdd7 /editors/code/src
parent7f7d96cffed6ed4836432a16cfc1dbd080bbab17 (diff)
downloadrust-b49508ffe3d34be0520c594bae69e906f22af513.tar.gz
rust-b49508ffe3d34be0520c594bae69e906f22af513.zip
Fix flickering with new syntax highlighting
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/client.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 44bd04c21b7..1f90af89839 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<lc.LanguageClient> {
     // '.' 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(