diff options
author | Veetaha <[email protected]> | 2020-06-18 13:02:36 +0100 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-06-18 13:02:36 +0100 |
commit | 6e81c9a921b975be7f2efb927dab4f3cfd505ebc (patch) | |
tree | 7933d1a5988f5e62c759534d3251a1d39c090f89 /crates/rust-analyzer | |
parent | 76c1160ffa626fc5f07b309420e6666eb79a3311 (diff) |
Flatten Task enum ¯\_(ツ)_/¯
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 740c52e21..7a81db3d9 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -243,7 +243,8 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { | |||
243 | #[derive(Debug)] | 243 | #[derive(Debug)] |
244 | enum Task { | 244 | enum Task { |
245 | Respond(Response), | 245 | Respond(Response), |
246 | SendMessage(Message), | 246 | Notify(Notification), |
247 | SendRequest(Request), | ||
247 | Diagnostic(DiagnosticTask), | 248 | Diagnostic(DiagnosticTask), |
248 | } | 249 | } |
249 | 250 | ||
@@ -275,7 +276,7 @@ impl fmt::Debug for Event { | |||
275 | return debug_verbose_not(not, f); | 276 | return debug_verbose_not(not, f); |
276 | } | 277 | } |
277 | } | 278 | } |
278 | Event::Task(Task::SendMessage(Message::Notification(not))) => { | 279 | Event::Task(Task::Notify(not)) => { |
279 | if notification_is::<lsp_types::notification::PublishDiagnostics>(not) { | 280 | if notification_is::<lsp_types::notification::PublishDiagnostics>(not) { |
280 | return debug_verbose_not(not, f); | 281 | return debug_verbose_not(not, f); |
281 | } | 282 | } |
@@ -463,7 +464,7 @@ fn on_progress_report( | |||
463 | token: lsp_types::ProgressToken::String(token.to_string()), | 464 | token: lsp_types::ProgressToken::String(token.to_string()), |
464 | }, | 465 | }, |
465 | ); | 466 | ); |
466 | task_sender.send(Task::SendMessage(create_progress_req.into())).unwrap(); | 467 | task_sender.send(Task::SendRequest(create_progress_req.into())).unwrap(); |
467 | }; | 468 | }; |
468 | 469 | ||
469 | let (token, progress) = match report { | 470 | let (token, progress) = match report { |
@@ -526,7 +527,7 @@ fn on_progress_report( | |||
526 | value: lsp_types::ProgressParamsValue::WorkDone(progress), | 527 | value: lsp_types::ProgressParamsValue::WorkDone(progress), |
527 | }; | 528 | }; |
528 | let not = notification_new::<lsp_types::notification::Progress>(params); | 529 | let not = notification_new::<lsp_types::notification::Progress>(params); |
529 | task_sender.send(Task::SendMessage(not.into())).unwrap() | 530 | task_sender.send(Task::Notify(not.into())).unwrap() |
530 | } | 531 | } |
531 | 532 | ||
532 | fn on_task( | 533 | fn on_task( |
@@ -543,7 +544,8 @@ fn on_task( | |||
543 | msg_sender.send(response.into()).unwrap(); | 544 | msg_sender.send(response.into()).unwrap(); |
544 | } | 545 | } |
545 | } | 546 | } |
546 | Task::SendMessage(msg) => msg_sender.send(msg).unwrap(), | 547 | Task::Notify(not) => msg_sender.send(not.into()).unwrap(), |
548 | Task::SendRequest(req) => msg_sender.send(req.into()).unwrap(), | ||
547 | Task::Diagnostic(task) => on_diagnostic_task(task, msg_sender, state), | 549 | Task::Diagnostic(task) => on_diagnostic_task(task, msg_sender, state), |
548 | } | 550 | } |
549 | } | 551 | } |