Run prettier on all files

This commit is contained in:
Daniel McNab 2018-10-08 22:38:33 +01:00
parent 3a405b65d6
commit e26071d96e
23 changed files with 220 additions and 129 deletions

View file

@ -10,16 +10,23 @@ interface FindMatchingBraceParams {
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: FindMatchingBraceParams = {
textDocument: { uri: editor.document.uri.toString() },
offsets: editor.selections.map((s) => {
offsets: editor.selections.map(s => {
return Server.client.code2ProtocolConverter.asPosition(s.active);
}),
})
};
const response = await Server.client.sendRequest<Position[]>('m/findMatchingBrace', request);
const response = await Server.client.sendRequest<Position[]>(
'm/findMatchingBrace',
request
);
editor.selections = editor.selections.map((sel, idx) => {
const active = Server.client.protocol2CodeConverter.asPosition(response[idx]);
const active = Server.client.protocol2CodeConverter.asPosition(
response[idx]
);
const anchor = sel.isEmpty ? active : sel.anchor;
return new vscode.Selection(anchor, active);
});