aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-17 20:24:33 +0100
committerAleksey Kladov <[email protected]>2020-05-19 19:28:27 +0100
commita752853350639a915178ea900a51f3c45443795e (patch)
tree53fe8ac7cc20109436fb54dfde9ed1c4baba1ad2 /editors
parentfa2e5299c3332b99fcd09fd54e8d812a6c34b0cc (diff)
Add snippetTextEdit protocol extension
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/client.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index cffdcf11a..2067738ea 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -35,7 +35,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
35 } as any 35 } as any
36 }; 36 };
37 37
38 const res = new lc.LanguageClient( 38 const client = new lc.LanguageClient(
39 'rust-analyzer', 39 'rust-analyzer',
40 'Rust Analyzer Language Server', 40 'Rust Analyzer Language Server',
41 serverOptions, 41 serverOptions,
@@ -47,8 +47,19 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
47 // since they are available on stable. 47 // since they are available on stable.
48 // Note that while these features are stable in vscode their LSP protocol 48 // Note that while these features are stable in vscode their LSP protocol
49 // implementations are still in the "proposed" category for 3.16. 49 // implementations are still in the "proposed" category for 3.16.
50 res.registerFeature(new CallHierarchyFeature(res)); 50 client.registerFeature(new CallHierarchyFeature(client));
51 res.registerFeature(new SemanticTokensFeature(res)); 51 client.registerFeature(new SemanticTokensFeature(client));
52 client.registerFeature(new SnippetTextEditFeature());
52 53
53 return res; 54 return client;
55}
56
57class SnippetTextEditFeature implements lc.StaticFeature {
58 fillClientCapabilities(capabilities: lc.ClientCapabilities): void {
59 const caps: any = capabilities.experimental ?? {};
60 caps.snippetTextEdit = true;
61 capabilities.experimental = caps
62 }
63 initialize(_capabilities: lc.ServerCapabilities<any>, _documentSelector: lc.DocumentSelector | undefined): void {
64 }
54} 65}