Move to vscode-languageclient 7.0.0-next.9

Stabilizes call hierarchy and semantic tokens features.
This commit is contained in:
kjeremy 2020-09-01 12:53:07 -04:00
parent 3ffa915cbc
commit b527257330
13 changed files with 49 additions and 59 deletions

View file

@ -1,10 +1,7 @@
import * as lc from 'vscode-languageclient';
import * as lc from 'vscode-languageclient/node';
import * as vscode from 'vscode';
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 } from 'vscode-languageclient/lib/semanticTokens.proposed';
import * as Is from 'vscode-languageclient/lib/common/utils/is';
import { assert } from './util';
function renderCommand(cmd: ra.CommandLink) {
@ -57,7 +54,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
return hover;
},
(error) => {
client.logFailedRequest(lc.HoverRequest.type, error);
client.handleFailedRequest(lc.HoverRequest.type, error, null);
return Promise.resolve(null);
});
},
@ -140,12 +137,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
);
// To turn on all proposed features use: client.registerProposedFeatures();
// Here we want to enable CallHierarchyFeature and SemanticTokensFeature
// since they are available on stable.
// Note that while these features are stable in vscode their LSP protocol
// implementations are still in the "proposed" category for 3.16.
client.registerFeature(new CallHierarchyFeature(client));
client.registerFeature(new SemanticTokensFeature(client));
client.registerFeature(new ExperimentalFeatures());
return client;

View file

@ -63,7 +63,7 @@ export function memoryUsage(ctx: Ctx): Cmd {
provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult<string> {
if (!vscode.window.activeTextEditor) return '';
return ctx.client.sendRequest(ra.memoryUsage, null).then((mem) => {
return ctx.client.sendRequest(ra.memoryUsage, null).then((mem: any) => {
return 'Per-query memory usage:\n' + mem + '\n(note: database has been cleared)';
});
}
@ -121,7 +121,7 @@ export function joinLines(ctx: Ctx): Cmd {
textDocument: { uri: editor.document.uri.toString() },
});
editor.edit((builder) => {
client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => {
client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
builder.replace(edit.range, edit.newText);
});
});
@ -140,8 +140,8 @@ export function onEnter(ctx: Ctx): Cmd {
position: client.code2ProtocolConverter.asPosition(
editor.selection.active,
),
}).catch(_error => {
// client.logFailedRequest(OnEnterRequest.type, error);
}).catch((_error: any) => {
// client.handleFailedRequest(OnEnterRequest.type, error, null);
return null;
});
if (!lcEdits) return false;

View file

@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import * as lc from 'vscode-languageclient';
import * as lc from 'vscode-languageclient/node';
import * as ra from './lsp_ext';
import { Config } from './config';

View file

@ -1,4 +1,4 @@
import * as lc from "vscode-languageclient";
import * as lc from "vscode-languageclient/node";
import * as vscode from "vscode";
import { strict as nativeAssert } from "assert";
import { spawnSync } from "child_process";