aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2021-02-16 21:27:30 +0000
committerkjeremy <[email protected]>2021-02-16 21:27:30 +0000
commita403be6456a0f579e5536e19aa230a425e7ea71b (patch)
treeb7a24119c7eee3b39579ee62494f516e136df6e2 /editors
parent13008c4d30968155fdac3a1bd383045f3dd89dc0 (diff)
Remove Semantic Tokens flicker workaround
https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with the latest vscode-languageclient release.
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/client.ts17
1 files changed, 0 insertions, 17 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index db5f4c023..0771ca3b6 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -2,7 +2,6 @@ import * as lc from 'vscode-languageclient/node';
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3import * as ra from '../src/lsp_ext'; 3import * as ra from '../src/lsp_ext';
4import * as Is from 'vscode-languageclient/lib/common/utils/is'; 4import * as Is from 'vscode-languageclient/lib/common/utils/is';
5import { DocumentSemanticsTokensSignature, DocumentSemanticsTokensEditsSignature, DocumentRangeSemanticTokensSignature } from 'vscode-languageclient/lib/common/semanticTokens';
6import { assert } from './util'; 5import { assert } from './util';
7import { WorkspaceEdit } from 'vscode'; 6import { WorkspaceEdit } from 'vscode';
8 7
@@ -24,13 +23,6 @@ function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownStri
24 return result; 23 return result;
25} 24}
26 25
27// Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576
28async function semanticHighlightingWorkaround<R, F extends (...args: any[]) => vscode.ProviderResult<R>>(next: F, ...args: Parameters<F>): Promise<R> {
29 const res = await next(...args);
30 if (res == null) throw new Error('busy');
31 return res;
32}
33
34export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc.LanguageClient { 26export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc.LanguageClient {
35 // '.' Is the fallback if no folder is open 27 // '.' Is the fallback if no folder is open
36 // TODO?: Workspace folders support Uri's (eg: file://test.txt). 28 // TODO?: Workspace folders support Uri's (eg: file://test.txt).
@@ -57,15 +49,6 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc
57 diagnosticCollectionName: "rustc", 49 diagnosticCollectionName: "rustc",
58 traceOutputChannel, 50 traceOutputChannel,
59 middleware: { 51 middleware: {
60 provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> {
61 return semanticHighlightingWorkaround(next, document, token);
62 },
63 provideDocumentSemanticTokensEdits(document: vscode.TextDocument, previousResultId: string, token: vscode.CancellationToken, next: DocumentSemanticsTokensEditsSignature): vscode.ProviderResult<vscode.SemanticTokensEdits | vscode.SemanticTokens> {
64 return semanticHighlightingWorkaround(next, document, previousResultId, token);
65 },
66 provideDocumentRangeSemanticTokens(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken, next: DocumentRangeSemanticTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> {
67 return semanticHighlightingWorkaround(next, document, range, token);
68 },
69 async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) { 52 async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) {
70 return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then( 53 return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(
71 (result) => { 54 (result) => {