mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Run prettier on all files
This commit is contained in:
parent
3a405b65d6
commit
e26071d96e
23 changed files with 220 additions and 129 deletions
|
@ -2,7 +2,10 @@ import * as vscode from 'vscode';
|
|||
|
||||
import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
|
||||
import { Server } from '../server';
|
||||
import { handle as applySourceChange, SourceChange } from './apply_source_change';
|
||||
import {
|
||||
handle as applySourceChange,
|
||||
SourceChange
|
||||
} from './apply_source_change';
|
||||
|
||||
interface JoinLinesParams {
|
||||
textDocument: TextDocumentIdentifier;
|
||||
|
@ -11,11 +14,16 @@ interface JoinLinesParams {
|
|||
|
||||
export async function handle() {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor == null || editor.document.languageId !== 'rust') { return; }
|
||||
if (editor == null || editor.document.languageId !== 'rust') {
|
||||
return;
|
||||
}
|
||||
const request: JoinLinesParams = {
|
||||
range: Server.client.code2ProtocolConverter.asRange(editor.selection),
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
textDocument: { uri: editor.document.uri.toString() }
|
||||
};
|
||||
const change = await Server.client.sendRequest<SourceChange>('m/joinLines', request);
|
||||
const change = await Server.client.sendRequest<SourceChange>(
|
||||
'm/joinLines',
|
||||
request
|
||||
);
|
||||
await applySourceChange(change);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue