Remove Semantic Tokens flicker workaround
https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with the latest vscode-languageclient release.
This commit is contained in:
parent
13008c4d30
commit
a403be6456
@ -2,7 +2,6 @@ import * as lc from 'vscode-languageclient/node';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as ra from '../src/lsp_ext';
|
import * as ra from '../src/lsp_ext';
|
||||||
import * as Is from 'vscode-languageclient/lib/common/utils/is';
|
import * as Is from 'vscode-languageclient/lib/common/utils/is';
|
||||||
import { DocumentSemanticsTokensSignature, DocumentSemanticsTokensEditsSignature, DocumentRangeSemanticTokensSignature } from 'vscode-languageclient/lib/common/semanticTokens';
|
|
||||||
import { assert } from './util';
|
import { assert } from './util';
|
||||||
import { WorkspaceEdit } from 'vscode';
|
import { WorkspaceEdit } from 'vscode';
|
||||||
|
|
||||||
@ -24,13 +23,6 @@ function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownStri
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576
|
|
||||||
async function semanticHighlightingWorkaround<R, F extends (...args: any[]) => vscode.ProviderResult<R>>(next: F, ...args: Parameters<F>): Promise<R> {
|
|
||||||
const res = await next(...args);
|
|
||||||
if (res == null) throw new Error('busy');
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc.LanguageClient {
|
export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc.LanguageClient {
|
||||||
// '.' Is the fallback if no folder is open
|
// '.' Is the fallback if no folder is open
|
||||||
// TODO?: Workspace folders support Uri's (eg: file://test.txt).
|
// TODO?: Workspace folders support Uri's (eg: file://test.txt).
|
||||||
@ -57,15 +49,6 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc
|
|||||||
diagnosticCollectionName: "rustc",
|
diagnosticCollectionName: "rustc",
|
||||||
traceOutputChannel,
|
traceOutputChannel,
|
||||||
middleware: {
|
middleware: {
|
||||||
provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> {
|
|
||||||
return semanticHighlightingWorkaround(next, document, token);
|
|
||||||
},
|
|
||||||
provideDocumentSemanticTokensEdits(document: vscode.TextDocument, previousResultId: string, token: vscode.CancellationToken, next: DocumentSemanticsTokensEditsSignature): vscode.ProviderResult<vscode.SemanticTokensEdits | vscode.SemanticTokens> {
|
|
||||||
return semanticHighlightingWorkaround(next, document, previousResultId, token);
|
|
||||||
},
|
|
||||||
provideDocumentRangeSemanticTokens(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken, next: DocumentRangeSemanticTokensSignature): vscode.ProviderResult<vscode.SemanticTokens> {
|
|
||||||
return semanticHighlightingWorkaround(next, document, range, token);
|
|
||||||
},
|
|
||||||
async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) {
|
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(
|
return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(
|
||||||
(result) => {
|
(result) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user