diff options
| author | bors <bors@rust-lang.org> | 2022-08-19 06:58:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-19 06:58:52 +0000 |
| commit | 04c487dd516e30f3145bb792c3cbf2265e8e55b3 (patch) | |
| tree | 5c8e63d7611468d98a1965da9483e8f7289f3903 /editors/code | |
| parent | 917bd68b37de4e60e7203061a0a9c23b74d2b5c2 (diff) | |
| parent | 45b7b6a60a7404d093f4afe81a0da10824cef7b8 (diff) | |
| download | rust-04c487dd516e30f3145bb792c3cbf2265e8e55b3.tar.gz rust-04c487dd516e30f3145bb792c3cbf2265e8e55b3.zip | |
Auto merge of #13063 - Veykril:stop-flycheck, r=Veykril
Implement lsp extension for cancelling running flychecks Fixes https://github.com/rust-lang/rust-analyzer/issues/4828
Diffstat (limited to 'editors/code')
| -rw-r--r-- | editors/code/package.json | 5 | ||||
| -rw-r--r-- | editors/code/src/commands.ts | 6 | ||||
| -rw-r--r-- | editors/code/src/lsp_ext.ts | 30 | ||||
| -rw-r--r-- | editors/code/src/main.ts | 1 |
4 files changed, 29 insertions, 13 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index 0714b356fe0..2e38c057302 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -235,6 +235,11 @@ "command": "rust-analyzer.moveItemDown", "title": "Move item down", "category": "rust-analyzer" + }, + { + "command": "rust-analyzer.cancelFlycheck", + "title": "Cancel running flychecks", + "category": "rust-analyzer" } ], "keybindings": [ diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 12f666401fd..a21b304bbda 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -817,6 +817,12 @@ export function openDocs(ctx: Ctx): Cmd { }; } +export function cancelFlycheck(ctx: Ctx): Cmd { + return async () => { + await ctx.client.sendRequest(ra.cancelFlycheck); + }; +} + export function resolveCodeAction(ctx: Ctx): Cmd { const client = ctx.client; return async (params: lc.CodeAction) => { diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index f80af78a74a..875261c48a6 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts @@ -75,6 +75,23 @@ export const expandMacro = new lc.RequestType<ExpandMacroParams, ExpandedMacro | "rust-analyzer/expandMacro" ); +export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, TestInfo[], void>( + "rust-analyzer/relatedTests" +); + +export const cancelFlycheck = new lc.RequestType0<void, void>("rust-analyzer/cancelFlycheck"); + +// Experimental extensions + +export interface SsrParams { + query: string; + parseOnly: boolean; + textDocument: lc.TextDocumentIdentifier; + position: lc.Position; + selections: readonly lc.Range[]; +} +export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr"); + export interface MatchingBraceParams { textDocument: lc.TextDocumentIdentifier; positions: lc.Position[]; @@ -127,19 +144,6 @@ export interface TestInfo { runnable: Runnable; } -export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, TestInfo[], void>( - "rust-analyzer/relatedTests" -); - -export interface SsrParams { - query: string; - parseOnly: boolean; - textDocument: lc.TextDocumentIdentifier; - position: lc.Position; - selections: readonly lc.Range[]; -} -export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr"); - export interface CommandLink extends lc.Command { /** * A tooltip for the command, when represented in the UI. diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index d78b711a47a..a9847dd2a65 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -163,6 +163,7 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) { ctx.registerCommand("peekTests", commands.peekTests); ctx.registerCommand("moveItemUp", commands.moveItemUp); ctx.registerCommand("moveItemDown", commands.moveItemDown); + ctx.registerCommand("cancelFlycheck", commands.cancelFlycheck); defaultOnEnter.dispose(); ctx.registerCommand("onEnter", commands.onEnter); |
