Make cancelFlycheck request a notification

This commit is contained in:
Lukas Wirth 2022-12-17 23:29:25 +01:00
parent cdfe98fe94
commit d8ddde27f9
4 changed files with 4 additions and 5 deletions

View file

@ -132,9 +132,8 @@ pub struct ExpandedMacro {
pub enum CancelFlycheck {}
impl Request for CancelFlycheck {
impl Notification for CancelFlycheck {
type Params = ();
type Result = ();
const METHOD: &'static str = "rust-analyzer/cancelFlycheck";
}

View file

@ -635,7 +635,6 @@ impl GlobalState {
.on_sync_mut::<lsp_ext::ReloadWorkspace>(handlers::handle_workspace_reload)
.on_sync_mut::<lsp_ext::MemoryUsage>(handlers::handle_memory_usage)
.on_sync_mut::<lsp_ext::ShuffleCrateGraph>(handlers::handle_shuffle_crate_graph)
.on_sync_mut::<lsp_ext::CancelFlycheck>(handlers::handle_cancel_flycheck)
.on_sync::<lsp_ext::JoinLines>(handlers::handle_join_lines)
.on_sync::<lsp_ext::OnEnter>(handlers::handle_on_enter)
.on_sync::<lsp_types::request::SelectionRangeRequest>(handlers::handle_selection_range)
@ -822,6 +821,7 @@ impl GlobalState {
}
Ok(())
})?
.on::<lsp_ext::CancelFlycheck>(handlers::handle_cancel_flycheck)?
.on::<lsp_types::notification::DidChangeTextDocument>(|this, params| {
if let Ok(path) = from_proto::vfs_path(&params.text_document.uri) {
match this.mem_docs.get_mut(&path) {

View file

@ -788,7 +788,7 @@ export function openDocs(ctx: CtxInit): Cmd {
export function cancelFlycheck(ctx: CtxInit): Cmd {
return async () => {
await ctx.client.sendRequest(ra.cancelFlycheck);
await ctx.client.sendNotification(ra.cancelFlycheck);
};
}

View file

@ -79,7 +79,7 @@ export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, Te
"rust-analyzer/relatedTests"
);
export const cancelFlycheck = new lc.RequestType0<void, void>("rust-analyzer/cancelFlycheck");
export const cancelFlycheck = new lc.NotificationType0("rust-analyzer/cancelFlycheck");
export const runFlycheck = new lc.NotificationType<{
textDocument: lc.TextDocumentIdentifier | null;