aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2020-09-01 17:53:07 +0100
committerkjeremy <[email protected]>2020-09-02 14:40:59 +0100
commitb5272573300766d0c8417161c1a4f959abc9ff43 (patch)
treea22977735d0e6de4efd0395ac9dc64c70d0fc486 /editors/code/src
parent3ffa915cbcf4d7a3988142cd94da0463acc87c8a (diff)
Move to vscode-languageclient 7.0.0-next.9
Stabilizes call hierarchy and semantic tokens features.
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/client.ts15
-rw-r--r--editors/code/src/commands.ts8
-rw-r--r--editors/code/src/ctx.ts2
-rw-r--r--editors/code/src/util.ts2
4 files changed, 9 insertions, 18 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index f5db55b8c..1ba2352ee 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -1,10 +1,7 @@
1import * as lc from 'vscode-languageclient'; 1import * 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/utils/is'; 4import * as Is from 'vscode-languageclient/lib/common/utils/is';
5
6import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed';
7import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed';
8import { assert } from './util'; 5import { assert } from './util';
9 6
10function renderCommand(cmd: ra.CommandLink) { 7function renderCommand(cmd: ra.CommandLink) {
@@ -57,7 +54,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
57 return hover; 54 return hover;
58 }, 55 },
59 (error) => { 56 (error) => {
60 client.logFailedRequest(lc.HoverRequest.type, error); 57 client.handleFailedRequest(lc.HoverRequest.type, error, null);
61 return Promise.resolve(null); 58 return Promise.resolve(null);
62 }); 59 });
63 }, 60 },
@@ -140,12 +137,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
140 ); 137 );
141 138
142 // To turn on all proposed features use: client.registerProposedFeatures(); 139 // To turn on all proposed features use: client.registerProposedFeatures();
143 // Here we want to enable CallHierarchyFeature and SemanticTokensFeature
144 // since they are available on stable.
145 // Note that while these features are stable in vscode their LSP protocol
146 // implementations are still in the "proposed" category for 3.16.
147 client.registerFeature(new CallHierarchyFeature(client));
148 client.registerFeature(new SemanticTokensFeature(client));
149 client.registerFeature(new ExperimentalFeatures()); 140 client.registerFeature(new ExperimentalFeatures());
150 141
151 return client; 142 return client;
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index d0faf4745..69f2836ad 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -63,7 +63,7 @@ export function memoryUsage(ctx: Ctx): Cmd {
63 provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult<string> { 63 provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult<string> {
64 if (!vscode.window.activeTextEditor) return ''; 64 if (!vscode.window.activeTextEditor) return '';
65 65
66 return ctx.client.sendRequest(ra.memoryUsage, null).then((mem) => { 66 return ctx.client.sendRequest(ra.memoryUsage, null).then((mem: any) => {
67 return 'Per-query memory usage:\n' + mem + '\n(note: database has been cleared)'; 67 return 'Per-query memory usage:\n' + mem + '\n(note: database has been cleared)';
68 }); 68 });
69 } 69 }
@@ -121,7 +121,7 @@ export function joinLines(ctx: Ctx): Cmd {
121 textDocument: { uri: editor.document.uri.toString() }, 121 textDocument: { uri: editor.document.uri.toString() },
122 }); 122 });
123 editor.edit((builder) => { 123 editor.edit((builder) => {
124 client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { 124 client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
125 builder.replace(edit.range, edit.newText); 125 builder.replace(edit.range, edit.newText);
126 }); 126 });
127 }); 127 });
@@ -140,8 +140,8 @@ export function onEnter(ctx: Ctx): Cmd {
140 position: client.code2ProtocolConverter.asPosition( 140 position: client.code2ProtocolConverter.asPosition(
141 editor.selection.active, 141 editor.selection.active,
142 ), 142 ),
143 }).catch(_error => { 143 }).catch((_error: any) => {
144 // client.logFailedRequest(OnEnterRequest.type, error); 144 // client.handleFailedRequest(OnEnterRequest.type, error, null);
145 return null; 145 return null;
146 }); 146 });
147 if (!lcEdits) return false; 147 if (!lcEdits) return false;
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 543f7e02e..d39864d33 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -1,5 +1,5 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient/node';
3import * as ra from './lsp_ext'; 3import * as ra from './lsp_ext';
4 4
5import { Config } from './config'; 5import { Config } from './config';
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index ec2087502..08159b43c 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -1,4 +1,4 @@
1import * as lc from "vscode-languageclient"; 1import * as lc from "vscode-languageclient/node";
2import * as vscode from "vscode"; 2import * as vscode from "vscode";
3import { strict as nativeAssert } from "assert"; 3import { strict as nativeAssert } from "assert";
4import { spawnSync } from "child_process"; 4import { spawnSync } from "child_process";