mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Refactor applySourceChange
This commit is contained in:
parent
83d2527880
commit
5aebf1081d
7 changed files with 68 additions and 89 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue