mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 22:24:14 +00:00
vscode: migrate ssr to rust-analyzer-api.ts
This commit is contained in:
parent
8a8a4d08ef
commit
9ea63d5a86
1 changed files with 5 additions and 11 deletions
|
@ -1,6 +1,8 @@
|
||||||
import { Ctx, Cmd } from '../ctx';
|
|
||||||
import { applySourceChange, SourceChange } from '../source_change';
|
|
||||||
import * as vscode from 'vscode';
|
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 {
|
export function ssr(ctx: Ctx): Cmd {
|
||||||
return async () => {
|
return async () => {
|
||||||
|
@ -21,16 +23,8 @@ export function ssr(ctx: Ctx): Cmd {
|
||||||
|
|
||||||
if (!request) return;
|
if (!request) return;
|
||||||
|
|
||||||
const ssrRequest: SsrRequest = { arg: request };
|
const change = await client.sendRequest(ra.ssr, { arg: request },);
|
||||||
const change = await client.sendRequest<SourceChange>(
|
|
||||||
'rust-analyzer/ssr',
|
|
||||||
ssrRequest,
|
|
||||||
);
|
|
||||||
|
|
||||||
await applySourceChange(ctx, change);
|
await applySourceChange(ctx, change);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SsrRequest {
|
|
||||||
arg: string;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue