diff options
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r-- | editors/code/src/commands/index.ts | 47 | ||||
-rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 2 |
2 files changed, 16 insertions, 33 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index dc075aa82..5a4c1df5e 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts | |||
@@ -4,24 +4,24 @@ import * as lc from 'vscode-languageclient'; | |||
4 | import { Ctx, Cmd } from '../ctx'; | 4 | import { Ctx, Cmd } from '../ctx'; |
5 | import * as sourceChange from '../source_change'; | 5 | import * as sourceChange from '../source_change'; |
6 | 6 | ||
7 | import { analyzerStatus } from './analyzer_status'; | 7 | export * from './analyzer_status'; |
8 | import { matchingBrace } from './matching_brace'; | 8 | export * from './matching_brace'; |
9 | import { joinLines } from './join_lines'; | 9 | export * from './join_lines'; |
10 | import { onEnter } from './on_enter'; | 10 | export * from './on_enter'; |
11 | import { parentModule } from './parent_module'; | 11 | export * from './parent_module'; |
12 | import { syntaxTree } from './syntax_tree'; | 12 | export * from './syntax_tree'; |
13 | import { expandMacro } from './expand_macro'; | 13 | export * from './expand_macro'; |
14 | import { run, runSingle } from './runnables'; | 14 | export * from './runnables'; |
15 | 15 | ||
16 | function collectGarbage(ctx: Ctx): Cmd { | 16 | export function collectGarbage(ctx: Ctx): Cmd { |
17 | return async () => { | 17 | return async () => { |
18 | ctx.client?.sendRequest<null>('rust-analyzer/collectGarbage', null); | 18 | ctx.client?.sendRequest<null>('rust-analyzer/collectGarbage', null); |
19 | }; | 19 | }; |
20 | } | 20 | } |
21 | 21 | ||
22 | function showReferences(ctx: Ctx): Cmd { | 22 | export function showReferences(ctx: Ctx): Cmd { |
23 | return (uri: string, position: lc.Position, locations: lc.Location[]) => { | 23 | return (uri: string, position: lc.Position, locations: lc.Location[]) => { |
24 | let client = ctx.client; | 24 | const client = ctx.client; |
25 | if (client) { | 25 | if (client) { |
26 | vscode.commands.executeCommand( | 26 | vscode.commands.executeCommand( |
27 | 'editor.action.showReferences', | 27 | 'editor.action.showReferences', |
@@ -33,13 +33,13 @@ function showReferences(ctx: Ctx): Cmd { | |||
33 | }; | 33 | }; |
34 | } | 34 | } |
35 | 35 | ||
36 | function applySourceChange(ctx: Ctx): Cmd { | 36 | export function applySourceChange(ctx: Ctx): Cmd { |
37 | return async (change: sourceChange.SourceChange) => { | 37 | return async (change: sourceChange.SourceChange) => { |
38 | sourceChange.applySourceChange(ctx, change); | 38 | sourceChange.applySourceChange(ctx, change); |
39 | }; | 39 | }; |
40 | } | 40 | } |
41 | 41 | ||
42 | function selectAndApplySourceChange(ctx: Ctx): Cmd { | 42 | export function selectAndApplySourceChange(ctx: Ctx): Cmd { |
43 | return async (changes: sourceChange.SourceChange[]) => { | 43 | return async (changes: sourceChange.SourceChange[]) => { |
44 | if (changes.length === 1) { | 44 | if (changes.length === 1) { |
45 | await sourceChange.applySourceChange(ctx, changes[0]); | 45 | await sourceChange.applySourceChange(ctx, changes[0]); |
@@ -51,26 +51,9 @@ function selectAndApplySourceChange(ctx: Ctx): Cmd { | |||
51 | }; | 51 | }; |
52 | } | 52 | } |
53 | 53 | ||
54 | function reload(ctx: Ctx): Cmd { | 54 | export function reload(ctx: Ctx): Cmd { |
55 | return async () => { | 55 | return async () => { |
56 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); | 56 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); |
57 | await ctx.restartServer(); | 57 | await ctx.restartServer(); |
58 | }; | 58 | }; |
59 | } | 59 | } |
60 | |||
61 | export { | ||
62 | analyzerStatus, | ||
63 | expandMacro, | ||
64 | joinLines, | ||
65 | matchingBrace, | ||
66 | parentModule, | ||
67 | syntaxTree, | ||
68 | onEnter, | ||
69 | collectGarbage, | ||
70 | run, | ||
71 | runSingle, | ||
72 | showReferences, | ||
73 | applySourceChange, | ||
74 | selectAndApplySourceChange, | ||
75 | reload | ||
76 | }; | ||
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 02ea9f166..211f2251f 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts | |||
@@ -55,7 +55,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
55 | 55 | ||
56 | // We need to order this after LS updates, but there's no API for that. | 56 | // We need to order this after LS updates, but there's no API for that. |
57 | // Hence, good old setTimeout. | 57 | // Hence, good old setTimeout. |
58 | function afterLs(f: () => any) { | 58 | function afterLs(f: () => void) { |
59 | setTimeout(f, 10); | 59 | setTimeout(f, 10); |
60 | } | 60 | } |
61 | 61 | ||