aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/index.ts')
-rw-r--r--editors/code/src/commands/index.ts53
1 files changed, 0 insertions, 53 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
deleted file mode 100644
index bdb7fc3b0..000000000
--- a/editors/code/src/commands/index.ts
+++ /dev/null
@@ -1,53 +0,0 @@
1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
3import * as ra from '../rust-analyzer-api';
4
5import { Ctx, Cmd } from '../ctx';
6import * as sourceChange from '../source_change';
7
8export * from './analyzer_status';
9export * from './matching_brace';
10export * from './join_lines';
11export * from './on_enter';
12export * from './parent_module';
13export * from './syntax_tree';
14export * from './expand_macro';
15export * from './runnables';
16export * from './ssr';
17export * from './server_version';
18
19export function collectGarbage(ctx: Ctx): Cmd {
20 return async () => ctx.client.sendRequest(ra.collectGarbage, null);
21}
22
23export function showReferences(ctx: Ctx): Cmd {
24 return (uri: string, position: lc.Position, locations: lc.Location[]) => {
25 const client = ctx.client;
26 if (client) {
27 vscode.commands.executeCommand(
28 'editor.action.showReferences',
29 vscode.Uri.parse(uri),
30 client.protocol2CodeConverter.asPosition(position),
31 locations.map(client.protocol2CodeConverter.asLocation),
32 );
33 }
34 };
35}
36
37export function applySourceChange(ctx: Ctx): Cmd {
38 return async (change: ra.SourceChange) => {
39 await sourceChange.applySourceChange(ctx, change);
40 };
41}
42
43export function selectAndApplySourceChange(ctx: Ctx): Cmd {
44 return async (changes: ra.SourceChange[]) => {
45 if (changes.length === 1) {
46 await sourceChange.applySourceChange(ctx, changes[0]);
47 } else if (changes.length > 0) {
48 const selectedChange = await vscode.window.showQuickPick(changes);
49 if (!selectedChange) return;
50 await sourceChange.applySourceChange(ctx, selectedChange);
51 }
52 };
53}