mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
Add command for manually running flychecks
This commit is contained in:
parent
ba3e3282da
commit
a04feb915a
7 changed files with 133 additions and 80 deletions
|
@ -788,8 +788,17 @@ export function openDocs(ctx: CtxInit): Cmd {
|
|||
|
||||
export function cancelFlycheck(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
await ctx.client.sendRequest(ra.cancelFlycheck);
|
||||
};
|
||||
}
|
||||
|
||||
export function runFlycheck(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
const editor = ctx.activeRustEditor;
|
||||
const client = ctx.client;
|
||||
await client.sendRequest(ra.cancelFlycheck);
|
||||
const params = editor ? { uri: editor.document.uri.toString() } : null;
|
||||
|
||||
await client.sendNotification(ra.runFlycheck, { textDocument: params });
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -797,12 +806,12 @@ export function resolveCodeAction(ctx: CtxInit): Cmd {
|
|||
return async (params: lc.CodeAction) => {
|
||||
const client = ctx.client;
|
||||
params.command = undefined;
|
||||
const item = await client?.sendRequest(lc.CodeActionResolveRequest.type, params);
|
||||
const item = await client.sendRequest(lc.CodeActionResolveRequest.type, params);
|
||||
if (!item?.edit) {
|
||||
return;
|
||||
}
|
||||
const itemEdit = item.edit;
|
||||
const edit = await client?.protocol2CodeConverter.asWorkspaceEdit(itemEdit);
|
||||
const edit = await client.protocol2CodeConverter.asWorkspaceEdit(itemEdit);
|
||||
// filter out all text edits and recreate the WorkspaceEdit without them so we can apply
|
||||
// snippet edits on our own
|
||||
const lcFileSystemEdit = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue