diff options
author | Aleksey Kladov <[email protected]> | 2020-05-21 23:28:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-21 23:28:49 +0100 |
commit | 5ef4ebff2017d7bdfa03f0eccb9960a86c9b94ca (patch) | |
tree | 6458549d833ba628fd86d050cb5dd1238c590fc3 /editors | |
parent | 59732df8d40dfadc6dcf5951265416576399712a (diff) |
Use WorkspaceEdit for ssr
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/commands/ssr.ts | 6 | ||||
-rw-r--r-- | editors/code/src/rust-analyzer-api.ts | 2 |
2 files changed, 3 insertions, 5 deletions
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'; | |||
2 | import * as ra from "../rust-analyzer-api"; | 2 | import * as ra from "../rust-analyzer-api"; |
3 | 3 | ||
4 | import { Ctx, Cmd } from '../ctx'; | 4 | import { Ctx, Cmd } from '../ctx'; |
5 | import { applySourceChange } from '../source_change'; | ||
6 | 5 | ||
7 | export function ssr(ctx: Ctx): Cmd { | 6 | export function ssr(ctx: Ctx): Cmd { |
8 | return async () => { | 7 | return async () => { |
@@ -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 | } |
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 { | |||
112 | query: string; | 112 | query: string; |
113 | parseOnly: boolean; | 113 | parseOnly: boolean; |
114 | } | 114 | } |
115 | export const ssr = request<SsrParams, SourceChange>("ssr"); | 115 | export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, unknown>('experimental/ssr'); |
116 | 116 | ||
117 | 117 | ||
118 | export const publishDecorations = notification<PublishDecorationsParams>("publishDecorations"); | 118 | export const publishDecorations = notification<PublishDecorationsParams>("publishDecorations"); |