aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-16 09:48:09 +0000
committerGitHub <[email protected]>2020-03-16 09:48:09 +0000
commita99cac671c3e6105a0192acbb1a91cb83e453018 (patch)
treea6eb701b7fc1a7e83b686a04e498253ee1b34cb0 /editors/code
parent6616f336b28bcab7d693473c6d9263dff15639ae (diff)
parentb150965ed7994c679711bc807de301a12f5c7944 (diff)
Merge #3540
3540: Swtches to rust SSR query check r=matklad a=mikhail-m1 related to #3186 Co-authored-by: Mikhail Modin <[email protected]>
Diffstat (limited to 'editors/code')
-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 e09a203c9..9846f7343 100644
--- a/editors/code/src/rust-analyzer-api.ts
+++ b/editors/code/src/rust-analyzer-api.ts
@@ -107,7 +107,8 @@ export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints"
107 107
108 108
109export interface SsrParams { 109export interface SsrParams {
110 arg: string; 110 query: string;
111 parseOnly: boolean;
111} 112}
112export const ssr = request<SsrParams, SourceChange>("ssr"); 113export const ssr = request<SsrParams, SourceChange>("ssr");
113 114