diff options
Diffstat (limited to 'editors/code/src/commands/index.ts')
-rw-r--r-- | editors/code/src/commands/index.ts | 53 |
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 @@ | |||
1 | import * as vscode from 'vscode'; | ||
2 | import * as lc from 'vscode-languageclient'; | ||
3 | import * as ra from '../rust-analyzer-api'; | ||
4 | |||
5 | import { Ctx, Cmd } from '../ctx'; | ||
6 | import * as sourceChange from '../source_change'; | ||
7 | |||
8 | export * from './analyzer_status'; | ||
9 | export * from './matching_brace'; | ||
10 | export * from './join_lines'; | ||
11 | export * from './on_enter'; | ||
12 | export * from './parent_module'; | ||
13 | export * from './syntax_tree'; | ||
14 | export * from './expand_macro'; | ||
15 | export * from './runnables'; | ||
16 | export * from './ssr'; | ||
17 | export * from './server_version'; | ||
18 | |||
19 | export function collectGarbage(ctx: Ctx): Cmd { | ||
20 | return async () => ctx.client.sendRequest(ra.collectGarbage, null); | ||
21 | } | ||
22 | |||
23 | export 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 | |||
37 | export function applySourceChange(ctx: Ctx): Cmd { | ||
38 | return async (change: ra.SourceChange) => { | ||
39 | await sourceChange.applySourceChange(ctx, change); | ||
40 | }; | ||
41 | } | ||
42 | |||
43 | export 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 | } | ||