Refactor server lifecycle

This commit is contained in:
Aleksey Kladov 2019-12-31 18:14:00 +01:00
parent 0849f7001c
commit 087af54069
12 changed files with 216 additions and 199 deletions

View file

@ -6,13 +6,14 @@ import { applySourceChange, SourceChange } from '../source_change';
export function joinLines(ctx: Ctx): Cmd {
return async () => {
const editor = ctx.activeRustEditor;
if (!editor) return;
const client = ctx.client;
if (!editor || !client) return;
const request: JoinLinesParams = {
range: ctx.client.code2ProtocolConverter.asRange(editor.selection),
range: client.code2ProtocolConverter.asRange(editor.selection),
textDocument: { uri: editor.document.uri.toString() },
};
const change = await ctx.client.sendRequest<SourceChange>(
const change = await client.sendRequest<SourceChange>(
'rust-analyzer/joinLines',
request,
);