diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-08-19 08:52:31 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-08-19 08:54:53 +0200 |
| commit | 45b7b6a60a7404d093f4afe81a0da10824cef7b8 (patch) | |
| tree | 5c8e63d7611468d98a1965da9483e8f7289f3903 /editors/code/src | |
| parent | 917bd68b37de4e60e7203061a0a9c23b74d2b5c2 (diff) | |
| download | rust-45b7b6a60a7404d093f4afe81a0da10824cef7b8.tar.gz rust-45b7b6a60a7404d093f4afe81a0da10824cef7b8.zip | |
Implement lsp extension for cancelling running flychecks
Diffstat (limited to 'editors/code/src')
| -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 |
3 files changed, 24 insertions, 13 deletions
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); |
