aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/ssr.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/ssr.ts')
-rw-r--r--editors/code/src/commands/ssr.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts
index eee48c693..6fee051fd 100644
--- a/editors/code/src/commands/ssr.ts
+++ b/editors/code/src/commands/ssr.ts
@@ -10,20 +10,22 @@ export function ssr(ctx: Ctx): Cmd {
10 if (!client) return; 10 if (!client) return;
11 11
12 const options: vscode.InputBoxOptions = { 12 const options: vscode.InputBoxOptions = {
13 placeHolder: "foo($a:expr, $b:expr) ==>> bar($a, foo($b))", 13 value: "() ==>> ()",
14 prompt: "Enter request", 14 prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
15 validateInput: (x: string) => { 15 validateInput: async (x: string) => {
16 if (x.includes('==>>')) { 16 try {
17 return null; 17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
18 } catch (e) {
19 return e.toString();
18 } 20 }
19 return "Enter request: pattern ==>> template"; 21 return null;
20 } 22 }
21 }; 23 };
22 const request = await vscode.window.showInputBox(options); 24 const request = await vscode.window.showInputBox(options);
23 25
24 if (!request) return; 26 if (!request) return;
25 27
26 const change = await client.sendRequest(ra.ssr, { arg: request }); 28 const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false });
27 29
28 await applySourceChange(ctx, change); 30 await applySourceChange(ctx, change);
29 }; 31 };