aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/index.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-25 09:55:56 +0000
committerGitHub <[email protected]>2020-02-25 09:55:56 +0000
commit5e6f4ca6905e02a5fa34ef292fa2abefcd982222 (patch)
tree413691f3aab076538aac3c49bef015fb945d5320 /editors/code/src/commands/index.ts
parent558d263a0c602ef12914cbb10c263a9e2bb96bf2 (diff)
parent18b97d9d367d5fc1533c48157ebca7bb18b62e3c (diff)
Merge #3299
3299: vscode: migrate to request type api r=matklad a=Veetaha More type-safety to the god of type-safety. Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'editors/code/src/commands/index.ts')
-rw-r--r--editors/code/src/commands/index.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index 839245f48..bdb7fc3b0 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -1,5 +1,6 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3import * as ra from '../rust-analyzer-api';
3 4
4import { Ctx, Cmd } from '../ctx'; 5import { Ctx, Cmd } from '../ctx';
5import * as sourceChange from '../source_change'; 6import * as sourceChange from '../source_change';
@@ -16,9 +17,7 @@ export * from './ssr';
16export * from './server_version'; 17export * from './server_version';
17 18
18export function collectGarbage(ctx: Ctx): Cmd { 19export function collectGarbage(ctx: Ctx): Cmd {
19 return async () => { 20 return async () => ctx.client.sendRequest(ra.collectGarbage, null);
20 await ctx.client?.sendRequest<null>('rust-analyzer/collectGarbage', null);
21 };
22} 21}
23 22
24export function showReferences(ctx: Ctx): Cmd { 23export function showReferences(ctx: Ctx): Cmd {
@@ -36,13 +35,13 @@ export function showReferences(ctx: Ctx): Cmd {
36} 35}
37 36
38export function applySourceChange(ctx: Ctx): Cmd { 37export function applySourceChange(ctx: Ctx): Cmd {
39 return async (change: sourceChange.SourceChange) => { 38 return async (change: ra.SourceChange) => {
40 await sourceChange.applySourceChange(ctx, change); 39 await sourceChange.applySourceChange(ctx, change);
41 }; 40 };
42} 41}
43 42
44export function selectAndApplySourceChange(ctx: Ctx): Cmd { 43export function selectAndApplySourceChange(ctx: Ctx): Cmd {
45 return async (changes: sourceChange.SourceChange[]) => { 44 return async (changes: ra.SourceChange[]) => {
46 if (changes.length === 1) { 45 if (changes.length === 1) {
47 await sourceChange.applySourceChange(ctx, changes[0]); 46 await sourceChange.applySourceChange(ctx, changes[0]);
48 } else if (changes.length > 0) { 47 } else if (changes.length > 0) {