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
9bfeac708d
commit
ac3d0e8340
7 changed files with 18 additions and 23 deletions
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue