aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorMikhail Modin <[email protected]>2020-03-15 21:23:18 +0000
committerMikhail Modin <[email protected]>2020-03-15 21:23:18 +0000
commitb150965ed7994c679711bc807de301a12f5c7944 (patch)
treeb8e4e4aed87953ead767861ce5066b8cc950f868 /editors
parent530ff9f57fd27505302d082a6007b49d8b98c8af (diff)
Swtches to rust SSR query check
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands/ssr.ts16
-rw-r--r--editors/code/src/rust-analyzer-api.ts3
2 files changed, 11 insertions, 8 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 };
diff --git a/editors/code/src/rust-analyzer-api.ts b/editors/code/src/rust-analyzer-api.ts
index bd6e3ada0..6ad93715f 100644
--- a/editors/code/src/rust-analyzer-api.ts
+++ b/editors/code/src/rust-analyzer-api.ts
@@ -108,7 +108,8 @@ export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints"
108 108
109 109
110export interface SsrParams { 110export interface SsrParams {
111 arg: string; 111 query: string;
112 parseOnly: boolean;
112} 113}
113export const ssr = request<SsrParams, SourceChange>("ssr"); 114export const ssr = request<SsrParams, SourceChange>("ssr");
114 115