From 29e86c0c726c20cf1add94a322b9c147b67ca1f6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 14:53:43 +0100 Subject: More second command to Ctx --- editors/code/src/commands/analyzer_status.ts | 4 ++-- editors/code/src/commands/index.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'editors/code/src/commands') diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index 6e92c50ef..c9d32fe07 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; -import { Ctx } from '../ctx'; +import { Ctx, Cmd } from '../ctx'; // Shows status of rust-analyzer (for debugging) -export function analyzerStatus(ctx: Ctx) { +export function analyzerStatus(ctx: Ctx): Cmd { let poller: NodeJS.Timer | null = null; const tdcp = new TextDocumentContentProvider(ctx); diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index ec1995396..ed56f5a4e 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts @@ -1,3 +1,5 @@ +import { Ctx, Cmd } from '../ctx' + import { analyzerStatus } from './analyzer_status'; import * as applySourceChange from './apply_source_change'; import * as expandMacro from './expand_macro'; @@ -9,6 +11,10 @@ import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; +function collectGarbage(ctx: Ctx): Cmd { + return async () => { ctx.client.sendRequest('rust-analyzer/collectGarbage', null) } +} + export { analyzerStatus, applySourceChange, @@ -20,4 +26,5 @@ export { syntaxTree, onEnter, inlayHints, + collectGarbage }; -- cgit v1.2.3