Refactor applySourceChange

This commit is contained in:
Aleksey Kladov 2019-12-30 16:43:34 +01:00
parent 83d2527880
commit 5aebf1081d
7 changed files with 68 additions and 89 deletions

View file

@ -1,16 +1,14 @@
import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
import { Ctx, Cmd } from '../ctx';
import {
handle as applySourceChange,
SourceChange,
} from './apply_source_change';
applySourceChange, SourceChange
} from '../source_change';
export function joinLines(ctx: Ctx): Cmd {
return async () => {
const editor = ctx.activeRustEditor;
if (!editor) {
return;
}
if (!editor) return;
const request: JoinLinesParams = {
range: ctx.client.code2ProtocolConverter.asRange(editor.selection),
textDocument: { uri: editor.document.uri.toString() },
@ -19,7 +17,7 @@ export function joinLines(ctx: Ctx): Cmd {
'rust-analyzer/joinLines',
request,
);
await applySourceChange(change);
await applySourceChange(ctx, change);
}
}