diff options
author | Aleksey Kladov <[email protected]> | 2020-05-10 18:24:02 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-10 18:24:02 +0100 |
commit | bec3bf701c9e7d0a99c5a89e5c95ce543ce21dbe (patch) | |
tree | ebb15e1dc10956b015ccfd30df64ffe19c165e95 /crates/rust-analyzer/src/main_loop.rs | |
parent | a78e1573b1c65e1387102a42bb978d9e299fea39 (diff) |
Don't re-export lsp_types
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 147 |
1 files changed, 80 insertions, 67 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index e27d85dc9..333ecc859 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -104,7 +104,7 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection) | |||
104 | 104 | ||
105 | if project_roots.is_empty() && config.notifications.cargo_toml_not_found { | 105 | if project_roots.is_empty() && config.notifications.cargo_toml_not_found { |
106 | show_message( | 106 | show_message( |
107 | req::MessageType::Error, | 107 | lsp_types::MessageType::Error, |
108 | format!( | 108 | format!( |
109 | "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", | 109 | "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", |
110 | ws_roots.iter().format_with(", ", |it, f| f(&it.display())) | 110 | ws_roots.iter().format_with(", ", |it, f| f(&it.display())) |
@@ -124,7 +124,7 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection) | |||
124 | .map_err(|err| { | 124 | .map_err(|err| { |
125 | log::error!("failed to load workspace: {:#}", err); | 125 | log::error!("failed to load workspace: {:#}", err); |
126 | show_message( | 126 | show_message( |
127 | req::MessageType::Error, | 127 | lsp_types::MessageType::Error, |
128 | format!("rust-analyzer failed to load workspace: {:#}", err), | 128 | format!("rust-analyzer failed to load workspace: {:#}", err), |
129 | &connection.sender, | 129 | &connection.sender, |
130 | ); | 130 | ); |
@@ -142,23 +142,25 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection) | |||
142 | .collect::<std::result::Result<Vec<_>, _>>()?; | 142 | .collect::<std::result::Result<Vec<_>, _>>()?; |
143 | 143 | ||
144 | if let FilesWatcher::Client = config.files.watcher { | 144 | if let FilesWatcher::Client = config.files.watcher { |
145 | let registration_options = req::DidChangeWatchedFilesRegistrationOptions { | 145 | let registration_options = lsp_types::DidChangeWatchedFilesRegistrationOptions { |
146 | watchers: workspaces | 146 | watchers: workspaces |
147 | .iter() | 147 | .iter() |
148 | .flat_map(ProjectWorkspace::to_roots) | 148 | .flat_map(ProjectWorkspace::to_roots) |
149 | .filter(PackageRoot::is_member) | 149 | .filter(PackageRoot::is_member) |
150 | .map(|root| format!("{}/**/*.rs", root.path().display())) | 150 | .map(|root| format!("{}/**/*.rs", root.path().display())) |
151 | .map(|glob_pattern| req::FileSystemWatcher { glob_pattern, kind: None }) | 151 | .map(|glob_pattern| lsp_types::FileSystemWatcher { glob_pattern, kind: None }) |
152 | .collect(), | 152 | .collect(), |
153 | }; | 153 | }; |
154 | let registration = req::Registration { | 154 | let registration = lsp_types::Registration { |
155 | id: "file-watcher".to_string(), | 155 | id: "file-watcher".to_string(), |
156 | method: "workspace/didChangeWatchedFiles".to_string(), | 156 | method: "workspace/didChangeWatchedFiles".to_string(), |
157 | register_options: Some(serde_json::to_value(registration_options).unwrap()), | 157 | register_options: Some(serde_json::to_value(registration_options).unwrap()), |
158 | }; | 158 | }; |
159 | let params = req::RegistrationParams { registrations: vec![registration] }; | 159 | let params = lsp_types::RegistrationParams { registrations: vec![registration] }; |
160 | let request = | 160 | let request = request_new::<lsp_types::request::RegisterCapability>( |
161 | request_new::<req::RegisterCapability>(loop_state.next_request_id(), params); | 161 | loop_state.next_request_id(), |
162 | params, | ||
163 | ); | ||
162 | connection.sender.send(request.into()).unwrap(); | 164 | connection.sender.send(request.into()).unwrap(); |
163 | } | 165 | } |
164 | 166 | ||
@@ -258,14 +260,14 @@ impl fmt::Debug for Event { | |||
258 | 260 | ||
259 | match self { | 261 | match self { |
260 | Event::Msg(Message::Notification(not)) => { | 262 | Event::Msg(Message::Notification(not)) => { |
261 | if notification_is::<req::DidOpenTextDocument>(not) | 263 | if notification_is::<lsp_types::notification::DidOpenTextDocument>(not) |
262 | || notification_is::<req::DidChangeTextDocument>(not) | 264 | || notification_is::<lsp_types::notification::DidChangeTextDocument>(not) |
263 | { | 265 | { |
264 | return debug_verbose_not(not, f); | 266 | return debug_verbose_not(not, f); |
265 | } | 267 | } |
266 | } | 268 | } |
267 | Event::Task(Task::Notify(not)) => { | 269 | Event::Task(Task::Notify(not)) => { |
268 | if notification_is::<req::PublishDiagnostics>(not) { | 270 | if notification_is::<lsp_types::notification::PublishDiagnostics>(not) { |
269 | return debug_verbose_not(not, f); | 271 | return debug_verbose_not(not, f); |
270 | } | 272 | } |
271 | } | 273 | } |
@@ -450,7 +452,7 @@ fn loop_turn( | |||
450 | log::error!("overly long loop turn: {:?}", loop_duration); | 452 | log::error!("overly long loop turn: {:?}", loop_duration); |
451 | if env::var("RA_PROFILE").is_ok() { | 453 | if env::var("RA_PROFILE").is_ok() { |
452 | show_message( | 454 | show_message( |
453 | req::MessageType::Error, | 455 | lsp_types::MessageType::Error, |
454 | format!("overly long loop turn: {:?}", loop_duration), | 456 | format!("overly long loop turn: {:?}", loop_duration), |
455 | &connection.sender, | 457 | &connection.sender, |
456 | ); | 458 | ); |
@@ -503,7 +505,7 @@ fn on_request( | |||
503 | .on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))? | 505 | .on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))? |
504 | .on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? | 506 | .on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? |
505 | .on_sync::<req::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? | 507 | .on_sync::<req::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? |
506 | .on_sync::<req::SelectionRangeRequest>(|s, p| { | 508 | .on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| { |
507 | handlers::handle_selection_range(s.snapshot(), p) | 509 | handlers::handle_selection_range(s.snapshot(), p) |
508 | })? | 510 | })? |
509 | .on_sync::<req::FindMatchingBrace>(|s, p| { | 511 | .on_sync::<req::FindMatchingBrace>(|s, p| { |
@@ -512,32 +514,38 @@ fn on_request( | |||
512 | .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? | 514 | .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? |
513 | .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? | 515 | .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? |
514 | .on::<req::ExpandMacro>(handlers::handle_expand_macro)? | 516 | .on::<req::ExpandMacro>(handlers::handle_expand_macro)? |
515 | .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? | 517 | .on::<lsp_types::request::OnTypeFormatting>(handlers::handle_on_type_formatting)? |
516 | .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? | 518 | .on::<lsp_types::request::DocumentSymbolRequest>(handlers::handle_document_symbol)? |
517 | .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? | 519 | .on::<lsp_types::request::WorkspaceSymbol>(handlers::handle_workspace_symbol)? |
518 | .on::<req::GotoDefinition>(handlers::handle_goto_definition)? | 520 | .on::<lsp_types::request::GotoDefinition>(handlers::handle_goto_definition)? |
519 | .on::<req::GotoImplementation>(handlers::handle_goto_implementation)? | 521 | .on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)? |
520 | .on::<req::GotoTypeDefinition>(handlers::handle_goto_type_definition)? | 522 | .on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)? |
521 | .on::<req::ParentModule>(handlers::handle_parent_module)? | 523 | .on::<req::ParentModule>(handlers::handle_parent_module)? |
522 | .on::<req::Runnables>(handlers::handle_runnables)? | 524 | .on::<req::Runnables>(handlers::handle_runnables)? |
523 | .on::<req::Completion>(handlers::handle_completion)? | 525 | .on::<lsp_types::request::Completion>(handlers::handle_completion)? |
524 | .on::<req::CodeActionRequest>(handlers::handle_code_action)? | 526 | .on::<lsp_types::request::CodeActionRequest>(handlers::handle_code_action)? |
525 | .on::<req::CodeLensRequest>(handlers::handle_code_lens)? | 527 | .on::<lsp_types::request::CodeLensRequest>(handlers::handle_code_lens)? |
526 | .on::<req::CodeLensResolve>(handlers::handle_code_lens_resolve)? | 528 | .on::<lsp_types::request::CodeLensResolve>(handlers::handle_code_lens_resolve)? |
527 | .on::<req::FoldingRangeRequest>(handlers::handle_folding_range)? | 529 | .on::<lsp_types::request::FoldingRangeRequest>(handlers::handle_folding_range)? |
528 | .on::<req::SignatureHelpRequest>(handlers::handle_signature_help)? | 530 | .on::<lsp_types::request::SignatureHelpRequest>(handlers::handle_signature_help)? |
529 | .on::<req::HoverRequest>(handlers::handle_hover)? | 531 | .on::<lsp_types::request::HoverRequest>(handlers::handle_hover)? |
530 | .on::<req::PrepareRenameRequest>(handlers::handle_prepare_rename)? | 532 | .on::<lsp_types::request::PrepareRenameRequest>(handlers::handle_prepare_rename)? |
531 | .on::<req::Rename>(handlers::handle_rename)? | 533 | .on::<lsp_types::request::Rename>(handlers::handle_rename)? |
532 | .on::<req::References>(handlers::handle_references)? | 534 | .on::<lsp_types::request::References>(handlers::handle_references)? |
533 | .on::<req::Formatting>(handlers::handle_formatting)? | 535 | .on::<lsp_types::request::Formatting>(handlers::handle_formatting)? |
534 | .on::<req::DocumentHighlightRequest>(handlers::handle_document_highlight)? | 536 | .on::<lsp_types::request::DocumentHighlightRequest>(handlers::handle_document_highlight)? |
535 | .on::<req::InlayHints>(handlers::handle_inlay_hints)? | 537 | .on::<req::InlayHints>(handlers::handle_inlay_hints)? |
536 | .on::<req::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? | 538 | .on::<lsp_types::request::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? |
537 | .on::<req::CallHierarchyIncomingCalls>(handlers::handle_call_hierarchy_incoming)? | 539 | .on::<lsp_types::request::CallHierarchyIncomingCalls>( |
538 | .on::<req::CallHierarchyOutgoingCalls>(handlers::handle_call_hierarchy_outgoing)? | 540 | handlers::handle_call_hierarchy_incoming, |
539 | .on::<req::SemanticTokensRequest>(handlers::handle_semantic_tokens)? | 541 | )? |
540 | .on::<req::SemanticTokensRangeRequest>(handlers::handle_semantic_tokens_range)? | 542 | .on::<lsp_types::request::CallHierarchyOutgoingCalls>( |
543 | handlers::handle_call_hierarchy_outgoing, | ||
544 | )? | ||
545 | .on::<lsp_types::request::SemanticTokensRequest>(handlers::handle_semantic_tokens)? | ||
546 | .on::<lsp_types::request::SemanticTokensRangeRequest>( | ||
547 | handlers::handle_semantic_tokens_range, | ||
548 | )? | ||
541 | .on::<req::Ssr>(handlers::handle_ssr)? | 549 | .on::<req::Ssr>(handlers::handle_ssr)? |
542 | .finish(); | 550 | .finish(); |
543 | Ok(()) | 551 | Ok(()) |
@@ -549,7 +557,7 @@ fn on_notification( | |||
549 | loop_state: &mut LoopState, | 557 | loop_state: &mut LoopState, |
550 | not: Notification, | 558 | not: Notification, |
551 | ) -> Result<()> { | 559 | ) -> Result<()> { |
552 | let not = match notification_cast::<req::Cancel>(not) { | 560 | let not = match notification_cast::<lsp_types::notification::Cancel>(not) { |
553 | Ok(params) => { | 561 | Ok(params) => { |
554 | let id: RequestId = match params.id { | 562 | let id: RequestId = match params.id { |
555 | NumberOrString::Number(id) => id.into(), | 563 | NumberOrString::Number(id) => id.into(), |
@@ -567,7 +575,7 @@ fn on_notification( | |||
567 | } | 575 | } |
568 | Err(not) => not, | 576 | Err(not) => not, |
569 | }; | 577 | }; |
570 | let not = match notification_cast::<req::DidOpenTextDocument>(not) { | 578 | let not = match notification_cast::<lsp_types::notification::DidOpenTextDocument>(not) { |
571 | Ok(params) => { | 579 | Ok(params) => { |
572 | let uri = params.text_document.uri; | 580 | let uri = params.text_document.uri; |
573 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; | 581 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; |
@@ -580,7 +588,7 @@ fn on_notification( | |||
580 | } | 588 | } |
581 | Err(not) => not, | 589 | Err(not) => not, |
582 | }; | 590 | }; |
583 | let not = match notification_cast::<req::DidChangeTextDocument>(not) { | 591 | let not = match notification_cast::<lsp_types::notification::DidChangeTextDocument>(not) { |
584 | Ok(params) => { | 592 | Ok(params) => { |
585 | let DidChangeTextDocumentParams { text_document, content_changes } = params; | 593 | let DidChangeTextDocumentParams { text_document, content_changes } = params; |
586 | let world = state.snapshot(); | 594 | let world = state.snapshot(); |
@@ -595,7 +603,7 @@ fn on_notification( | |||
595 | } | 603 | } |
596 | Err(not) => not, | 604 | Err(not) => not, |
597 | }; | 605 | }; |
598 | let not = match notification_cast::<req::DidSaveTextDocument>(not) { | 606 | let not = match notification_cast::<lsp_types::notification::DidSaveTextDocument>(not) { |
599 | Ok(_params) => { | 607 | Ok(_params) => { |
600 | if let Some(flycheck) = &state.flycheck { | 608 | if let Some(flycheck) = &state.flycheck { |
601 | flycheck.update(); | 609 | flycheck.update(); |
@@ -604,7 +612,7 @@ fn on_notification( | |||
604 | } | 612 | } |
605 | Err(not) => not, | 613 | Err(not) => not, |
606 | }; | 614 | }; |
607 | let not = match notification_cast::<req::DidCloseTextDocument>(not) { | 615 | let not = match notification_cast::<lsp_types::notification::DidCloseTextDocument>(not) { |
608 | Ok(params) => { | 616 | Ok(params) => { |
609 | let uri = params.text_document.uri; | 617 | let uri = params.text_document.uri; |
610 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; | 618 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; |
@@ -612,22 +620,22 @@ fn on_notification( | |||
612 | loop_state.subscriptions.remove_sub(FileId(file_id.0)); | 620 | loop_state.subscriptions.remove_sub(FileId(file_id.0)); |
613 | } | 621 | } |
614 | let params = | 622 | let params = |
615 | req::PublishDiagnosticsParams { uri, diagnostics: Vec::new(), version: None }; | 623 | lsp_types::PublishDiagnosticsParams { uri, diagnostics: Vec::new(), version: None }; |
616 | let not = notification_new::<req::PublishDiagnostics>(params); | 624 | let not = notification_new::<lsp_types::notification::PublishDiagnostics>(params); |
617 | msg_sender.send(not.into()).unwrap(); | 625 | msg_sender.send(not.into()).unwrap(); |
618 | return Ok(()); | 626 | return Ok(()); |
619 | } | 627 | } |
620 | Err(not) => not, | 628 | Err(not) => not, |
621 | }; | 629 | }; |
622 | let not = match notification_cast::<req::DidChangeConfiguration>(not) { | 630 | let not = match notification_cast::<lsp_types::notification::DidChangeConfiguration>(not) { |
623 | Ok(_) => { | 631 | Ok(_) => { |
624 | // As stated in https://github.com/microsoft/language-server-protocol/issues/676, | 632 | // As stated in https://github.com/microsoft/language-server-protocol/issues/676, |
625 | // this notification's parameters should be ignored and the actual config queried separately. | 633 | // this notification's parameters should be ignored and the actual config queried separately. |
626 | let request_id = loop_state.next_request_id(); | 634 | let request_id = loop_state.next_request_id(); |
627 | let request = request_new::<req::WorkspaceConfiguration>( | 635 | let request = request_new::<lsp_types::request::WorkspaceConfiguration>( |
628 | request_id.clone(), | 636 | request_id.clone(), |
629 | req::ConfigurationParams { | 637 | lsp_types::ConfigurationParams { |
630 | items: vec![req::ConfigurationItem { | 638 | items: vec![lsp_types::ConfigurationItem { |
631 | scope_uri: None, | 639 | scope_uri: None, |
632 | section: Some("rust-analyzer".to_string()), | 640 | section: Some("rust-analyzer".to_string()), |
633 | }], | 641 | }], |
@@ -640,7 +648,7 @@ fn on_notification( | |||
640 | } | 648 | } |
641 | Err(not) => not, | 649 | Err(not) => not, |
642 | }; | 650 | }; |
643 | let not = match notification_cast::<req::DidChangeWatchedFiles>(not) { | 651 | let not = match notification_cast::<lsp_types::notification::DidChangeWatchedFiles>(not) { |
644 | Ok(params) => { | 652 | Ok(params) => { |
645 | let mut vfs = state.vfs.write(); | 653 | let mut vfs = state.vfs.write(); |
646 | for change in params.changes { | 654 | for change in params.changes { |
@@ -742,11 +750,11 @@ fn on_check_task( | |||
742 | } | 750 | } |
743 | 751 | ||
744 | CheckTask::Status(progress) => { | 752 | CheckTask::Status(progress) => { |
745 | let params = req::ProgressParams { | 753 | let params = lsp_types::ProgressParams { |
746 | token: req::ProgressToken::String("rustAnalyzer/cargoWatcher".to_string()), | 754 | token: lsp_types::ProgressToken::String("rustAnalyzer/cargoWatcher".to_string()), |
747 | value: req::ProgressParamsValue::WorkDone(progress), | 755 | value: lsp_types::ProgressParamsValue::WorkDone(progress), |
748 | }; | 756 | }; |
749 | let not = notification_new::<req::Progress>(params); | 757 | let not = notification_new::<lsp_types::notification::Progress>(params); |
750 | task_sender.send(Task::Notify(not)).unwrap(); | 758 | task_sender.send(Task::Notify(not)).unwrap(); |
751 | } | 759 | } |
752 | }; | 760 | }; |
@@ -768,8 +776,8 @@ fn on_diagnostic_task(task: DiagnosticTask, msg_sender: &Sender<Message>, state: | |||
768 | }; | 776 | }; |
769 | 777 | ||
770 | let diagnostics = state.diagnostics.diagnostics_for(file_id).cloned().collect(); | 778 | let diagnostics = state.diagnostics.diagnostics_for(file_id).cloned().collect(); |
771 | let params = req::PublishDiagnosticsParams { uri, diagnostics, version: None }; | 779 | let params = lsp_types::PublishDiagnosticsParams { uri, diagnostics, version: None }; |
772 | let not = notification_new::<req::PublishDiagnostics>(params); | 780 | let not = notification_new::<lsp_types::notification::PublishDiagnostics>(params); |
773 | msg_sender.send(not.into()).unwrap(); | 781 | msg_sender.send(not.into()).unwrap(); |
774 | } | 782 | } |
775 | } | 783 | } |
@@ -782,10 +790,10 @@ fn send_startup_progress(sender: &Sender<Message>, loop_state: &mut LoopState) { | |||
782 | 790 | ||
783 | match (prev, loop_state.workspace_loaded) { | 791 | match (prev, loop_state.workspace_loaded) { |
784 | (None, false) => { | 792 | (None, false) => { |
785 | let work_done_progress_create = request_new::<req::WorkDoneProgressCreate>( | 793 | let work_done_progress_create = request_new::<lsp_types::request::WorkDoneProgressCreate>( |
786 | loop_state.next_request_id(), | 794 | loop_state.next_request_id(), |
787 | WorkDoneProgressCreateParams { | 795 | WorkDoneProgressCreateParams { |
788 | token: req::ProgressToken::String("rustAnalyzer/startup".into()), | 796 | token: lsp_types::ProgressToken::String("rustAnalyzer/startup".into()), |
789 | }, | 797 | }, |
790 | ); | 798 | ); |
791 | sender.send(work_done_progress_create.into()).unwrap(); | 799 | sender.send(work_done_progress_create.into()).unwrap(); |
@@ -817,10 +825,11 @@ fn send_startup_progress(sender: &Sender<Message>, loop_state: &mut LoopState) { | |||
817 | } | 825 | } |
818 | 826 | ||
819 | fn send_startup_progress_notif(sender: &Sender<Message>, work_done_progress: WorkDoneProgress) { | 827 | fn send_startup_progress_notif(sender: &Sender<Message>, work_done_progress: WorkDoneProgress) { |
820 | let notif = notification_new::<req::Progress>(req::ProgressParams { | 828 | let notif = |
821 | token: req::ProgressToken::String("rustAnalyzer/startup".into()), | 829 | notification_new::<lsp_types::notification::Progress>(lsp_types::ProgressParams { |
822 | value: req::ProgressParamsValue::WorkDone(work_done_progress), | 830 | token: lsp_types::ProgressToken::String("rustAnalyzer/startup".into()), |
823 | }); | 831 | value: lsp_types::ProgressParamsValue::WorkDone(work_done_progress), |
832 | }); | ||
824 | sender.send(notif.into()).unwrap(); | 833 | sender.send(notif.into()).unwrap(); |
825 | } | 834 | } |
826 | } | 835 | } |
@@ -842,7 +851,7 @@ impl<'a> PoolDispatcher<'a> { | |||
842 | f: fn(&mut WorldState, R::Params) -> Result<R::Result>, | 851 | f: fn(&mut WorldState, R::Params) -> Result<R::Result>, |
843 | ) -> Result<&mut Self> | 852 | ) -> Result<&mut Self> |
844 | where | 853 | where |
845 | R: req::Request + 'static, | 854 | R: lsp_types::request::Request + 'static, |
846 | R::Params: DeserializeOwned + panic::UnwindSafe + 'static, | 855 | R::Params: DeserializeOwned + panic::UnwindSafe + 'static, |
847 | R::Result: Serialize + 'static, | 856 | R::Result: Serialize + 'static, |
848 | { | 857 | { |
@@ -865,7 +874,7 @@ impl<'a> PoolDispatcher<'a> { | |||
865 | /// Dispatches the request onto thread pool | 874 | /// Dispatches the request onto thread pool |
866 | fn on<R>(&mut self, f: fn(WorldSnapshot, R::Params) -> Result<R::Result>) -> Result<&mut Self> | 875 | fn on<R>(&mut self, f: fn(WorldSnapshot, R::Params) -> Result<R::Result>) -> Result<&mut Self> |
867 | where | 876 | where |
868 | R: req::Request + 'static, | 877 | R: lsp_types::request::Request + 'static, |
869 | R::Params: DeserializeOwned + Send + 'static, | 878 | R::Params: DeserializeOwned + Send + 'static, |
870 | R::Result: Serialize + 'static, | 879 | R::Result: Serialize + 'static, |
871 | { | 880 | { |
@@ -891,7 +900,7 @@ impl<'a> PoolDispatcher<'a> { | |||
891 | 900 | ||
892 | fn parse<R>(&mut self) -> Option<(RequestId, R::Params)> | 901 | fn parse<R>(&mut self) -> Option<(RequestId, R::Params)> |
893 | where | 902 | where |
894 | R: req::Request + 'static, | 903 | R: lsp_types::request::Request + 'static, |
895 | R::Params: DeserializeOwned + 'static, | 904 | R::Params: DeserializeOwned + 'static, |
896 | { | 905 | { |
897 | let req = self.req.take()?; | 906 | let req = self.req.take()?; |
@@ -928,7 +937,7 @@ impl<'a> PoolDispatcher<'a> { | |||
928 | 937 | ||
929 | fn result_to_task<R>(id: RequestId, result: Result<R::Result>) -> Task | 938 | fn result_to_task<R>(id: RequestId, result: Result<R::Result>) -> Task |
930 | where | 939 | where |
931 | R: req::Request + 'static, | 940 | R: lsp_types::request::Request + 'static, |
932 | R::Params: DeserializeOwned + 'static, | 941 | R::Params: DeserializeOwned + 'static, |
933 | R::Result: Serialize + 'static, | 942 | R::Result: Serialize + 'static, |
934 | { | 943 | { |
@@ -984,10 +993,14 @@ fn update_file_notifications_on_threadpool( | |||
984 | } | 993 | } |
985 | } | 994 | } |
986 | 995 | ||
987 | pub fn show_message(typ: req::MessageType, message: impl Into<String>, sender: &Sender<Message>) { | 996 | pub fn show_message( |
997 | typ: lsp_types::MessageType, | ||
998 | message: impl Into<String>, | ||
999 | sender: &Sender<Message>, | ||
1000 | ) { | ||
988 | let message = message.into(); | 1001 | let message = message.into(); |
989 | let params = req::ShowMessageParams { typ, message }; | 1002 | let params = lsp_types::ShowMessageParams { typ, message }; |
990 | let not = notification_new::<req::ShowMessage>(params); | 1003 | let not = notification_new::<lsp_types::notification::ShowMessage>(params); |
991 | sender.send(not.into()).unwrap(); | 1004 | sender.send(not.into()).unwrap(); |
992 | } | 1005 | } |
993 | 1006 | ||