aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-24 22:50:57 +0000
committerVeetaha <[email protected]>2020-02-24 22:50:57 +0000
commitc9a2fa1835a9b91d7e9332f7eceb8c899c727d32 (patch)
tree4d0d6429ded57e3cb9be6b29e8a4a2695ac10757 /editors/code/src/commands
parent31d9932d18151bffe94e4137ac3b5d10df37641f (diff)
vscode: migrate collectGarbage to rust-analyzer-api.ts
Diffstat (limited to 'editors/code/src/commands')
-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) {