From 5ef4ebff2017d7bdfa03f0eccb9960a86c9b94ca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 May 2020 00:28:49 +0200 Subject: Use WorkspaceEdit for ssr --- editors/code/src/commands/ssr.ts | 6 ++---- editors/code/src/rust-analyzer-api.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts index 4ef8cdf04..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'; import * as ra from "../rust-analyzer-api"; import { Ctx, Cmd } from '../ctx'; -import { applySourceChange } from '../source_change'; export function ssr(ctx: Ctx): Cmd { return async () => { @@ -22,11 +21,10 @@ export function ssr(ctx: Ctx): Cmd { } }; const request = await vscode.window.showInputBox(options); - if (!request) return; - const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); + const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); - await applySourceChange(ctx, change); + await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); }; } diff --git a/editors/code/src/rust-analyzer-api.ts b/editors/code/src/rust-analyzer-api.ts index 8ed56c173..73f36432f 100644 --- a/editors/code/src/rust-analyzer-api.ts +++ b/editors/code/src/rust-analyzer-api.ts @@ -112,7 +112,7 @@ export interface SsrParams { query: string; parseOnly: boolean; } -export const ssr = request("ssr"); +export const ssr = new lc.RequestType('experimental/ssr'); export const publishDecorations = notification("publishDecorations"); -- cgit v1.2.3