From c9a2fa1835a9b91d7e9332f7eceb8c899c727d32 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:50:57 +0200 Subject: [PATCH] vscode: migrate collectGarbage to rust-analyzer-api.ts --- editors/code/src/commands/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index 839245f4875..bdb7fc3b03b 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; import * as sourceChange from '../source_change'; @@ -16,9 +17,7 @@ export * from './ssr'; export * from './server_version'; export function collectGarbage(ctx: Ctx): Cmd { - return async () => { - await ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); - }; + return async () => ctx.client.sendRequest(ra.collectGarbage, null); } export function showReferences(ctx: Ctx): Cmd { @@ -36,13 +35,13 @@ export function showReferences(ctx: Ctx): Cmd { } export function applySourceChange(ctx: Ctx): Cmd { - return async (change: sourceChange.SourceChange) => { + return async (change: ra.SourceChange) => { await sourceChange.applySourceChange(ctx, change); }; } export function selectAndApplySourceChange(ctx: Ctx): Cmd { - return async (changes: sourceChange.SourceChange[]) => { + return async (changes: ra.SourceChange[]) => { if (changes.length === 1) { await sourceChange.applySourceChange(ctx, changes[0]); } else if (changes.length > 0) {