diff options
Diffstat (limited to 'editors/code/src/commands/ssr.ts')
-rw-r--r-- | editors/code/src/commands/ssr.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts deleted file mode 100644 index 6fee051fd..000000000 --- a/editors/code/src/commands/ssr.ts +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | import * as vscode from 'vscode'; | ||
2 | import * as ra from "../rust-analyzer-api"; | ||
3 | |||
4 | import { Ctx, Cmd } from '../ctx'; | ||
5 | import { applySourceChange } from '../source_change'; | ||
6 | |||
7 | export function ssr(ctx: Ctx): Cmd { | ||
8 | return async () => { | ||
9 | const client = ctx.client; | ||
10 | if (!client) return; | ||
11 | |||
12 | const options: vscode.InputBoxOptions = { | ||
13 | value: "() ==>> ()", | ||
14 | prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", | ||
15 | validateInput: async (x: string) => { | ||
16 | try { | ||
17 | await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); | ||
18 | } catch (e) { | ||
19 | return e.toString(); | ||
20 | } | ||
21 | return null; | ||
22 | } | ||
23 | }; | ||
24 | const request = await vscode.window.showInputBox(options); | ||
25 | |||
26 | if (!request) return; | ||
27 | |||
28 | const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); | ||
29 | |||
30 | await applySourceChange(ctx, change); | ||
31 | }; | ||
32 | } | ||