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.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts
index 6fee051fd..5d40a64d2 100644
--- a/editors/code/src/commands/ssr.ts
+++ b/editors/code/src/commands/ssr.ts
@@ -2,7 +2,6 @@ import * as vscode from 'vscode';
2import * as ra from "../rust-analyzer-api"; 2import * as ra from "../rust-analyzer-api";
3 3
4import { Ctx, Cmd } from '../ctx'; 4import { Ctx, Cmd } from '../ctx';
5import { applySourceChange } from '../source_change';
6 5
7export function ssr(ctx: Ctx): Cmd { 6export function ssr(ctx: Ctx): Cmd {
8 return async () => { 7 return async () => {
@@ -11,7 +10,7 @@ export function ssr(ctx: Ctx): Cmd {
11 10
12 const options: vscode.InputBoxOptions = { 11 const options: vscode.InputBoxOptions = {
13 value: "() ==>> ()", 12 value: "() ==>> ()",
14 prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", 13 prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
15 validateInput: async (x: string) => { 14 validateInput: async (x: string) => {
16 try { 15 try {
17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); 16 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
@@ -22,11 +21,10 @@ export function ssr(ctx: Ctx): Cmd {
22 } 21 }
23 }; 22 };
24 const request = await vscode.window.showInputBox(options); 23 const request = await vscode.window.showInputBox(options);
25
26 if (!request) return; 24 if (!request) return;
27 25
28 const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); 26 const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false });
29 27
30 await applySourceChange(ctx, change); 28 await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
31 }; 29 };
32} 30}