Run prettier on all files

This commit is contained in:
Aleksey Kladov 2019-12-30 18:31:08 +01:00
parent 9bfeac708d
commit ac3d0e8340
7 changed files with 18 additions and 23 deletions

View File

@ -19,7 +19,7 @@
"vscode:prepublish": "rollup -c",
"package": "vsce package",
"watch": "tsc -watch -p ./",
"prettier": "prettier --write **/*.ts"
"prettier": "prettier --write '**/*.ts'"
},
"dependencies": {
"jsonc-parser": "^2.1.0",

View File

@ -23,10 +23,7 @@ export function analyzerStatus(ctx: Ctx): Cmd {
return async function handle() {
if (poller == null) {
poller = setInterval(
() => tdcp.eventEmitter.fire(tdcp.uri),
1000,
);
poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000);
}
const document = await vscode.workspace.openTextDocument(tdcp.uri);
return vscode.window.showTextDocument(
@ -39,13 +36,12 @@ export function analyzerStatus(ctx: Ctx): Cmd {
class TextDocumentContentProvider
implements vscode.TextDocumentContentProvider {
ctx: Ctx
ctx: Ctx;
uri = vscode.Uri.parse('rust-analyzer-status://status');
eventEmitter = new vscode.EventEmitter<vscode.Uri>();
constructor(ctx: Ctx) {
this.ctx = ctx
this.ctx = ctx;
}
provideTextDocumentContent(

View File

@ -1,4 +1,4 @@
import { Ctx, Cmd } from '../ctx'
import { Ctx, Cmd } from '../ctx';
import { analyzerStatus } from './analyzer_status';
import { matchingBrace } from './matching_brace';
@ -11,7 +11,9 @@ import * as runnables from './runnables';
import * as syntaxTree from './syntaxTree';
function collectGarbage(ctx: Ctx): Cmd {
return async () => { ctx.client.sendRequest<null>('rust-analyzer/collectGarbage', null) }
return async () => {
ctx.client.sendRequest<null>('rust-analyzer/collectGarbage', null);
};
}
export {
@ -24,5 +26,5 @@ export {
syntaxTree,
onEnter,
inlayHints,
collectGarbage
collectGarbage,
};

View File

@ -1,8 +1,6 @@
import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
import { Ctx, Cmd } from '../ctx';
import {
applySourceChange, SourceChange
} from '../source_change';
import { applySourceChange, SourceChange } from '../source_change';
export function joinLines(ctx: Ctx): Cmd {
return async () => {
@ -18,7 +16,7 @@ export function joinLines(ctx: Ctx): Cmd {
request,
);
await applySourceChange(ctx, change);
}
};
}
interface JoinLinesParams {

View File

@ -10,7 +10,9 @@ export function matchingBrace(ctx: Ctx): Cmd {
}
const request: FindMatchingBraceParams = {
textDocument: { uri: editor.document.uri.toString() },
offsets: editor.selections.map(s => ctx.client.code2ProtocolConverter.asPosition(s.active)),
offsets: editor.selections.map(s =>
ctx.client.code2ProtocolConverter.asPosition(s.active),
),
};
const response = await ctx.client.sendRequest<Position[]>(
'rust-analyzer/findMatchingBrace',
@ -24,7 +26,7 @@ export function matchingBrace(ctx: Ctx): Cmd {
return new vscode.Selection(anchor, active);
});
editor.revealRange(editor.selection);
}
};
}
interface FindMatchingBraceParams {

View File

@ -1,8 +1,5 @@
import * as lc from 'vscode-languageclient';
import {
applySourceChange,
SourceChange,
} from '../source_change';
import { applySourceChange, SourceChange } from '../source_change';
import { Cmd, Ctx } from '../ctx';
export function onEnter(ctx: Ctx): Cmd {
@ -24,5 +21,5 @@ export function onEnter(ctx: Ctx): Cmd {
await applySourceChange(ctx, change);
return true;
}
};
}

View File

@ -28,5 +28,5 @@ export function parentModule(ctx: Ctx): Cmd {
const e = await vscode.window.showTextDocument(doc);
e.selection = new vscode.Selection(range.start, range.start);
e.revealRange(range, vscode.TextEditorRevealType.InCenter);
}
};
}