diff options
author | Veetaha <[email protected]> | 2020-02-24 22:50:57 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-24 22:50:57 +0000 |
commit | c9a2fa1835a9b91d7e9332f7eceb8c899c727d32 (patch) | |
tree | 4d0d6429ded57e3cb9be6b29e8a4a2695ac10757 /editors/code | |
parent | 31d9932d18151bffe94e4137ac3b5d10df37641f (diff) |
vscode: migrate collectGarbage to rust-analyzer-api.ts
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/commands/index.ts | 9 |
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 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | import * as ra from '../rust-analyzer-api'; | ||
3 | 4 | ||
4 | import { Ctx, Cmd } from '../ctx'; | 5 | import { Ctx, Cmd } from '../ctx'; |
5 | import * as sourceChange from '../source_change'; | 6 | import * as sourceChange from '../source_change'; |
@@ -16,9 +17,7 @@ export * from './ssr'; | |||
16 | export * from './server_version'; | 17 | export * from './server_version'; |
17 | 18 | ||
18 | export function collectGarbage(ctx: Ctx): Cmd { | 19 | export 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 | ||
24 | export function showReferences(ctx: Ctx): Cmd { | 23 | export function showReferences(ctx: Ctx): Cmd { |
@@ -36,13 +35,13 @@ export function showReferences(ctx: Ctx): Cmd { | |||
36 | } | 35 | } |
37 | 36 | ||
38 | export function applySourceChange(ctx: Ctx): Cmd { | 37 | export 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 | ||
44 | export function selectAndApplySourceChange(ctx: Ctx): Cmd { | 43 | export 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) { |