diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 147 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 68 | ||||
-rw-r--r-- | crates/rust-analyzer/src/req.rs | 23 |
3 files changed, 119 insertions, 119 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 | ||
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 4f619654f..7aa77d19a 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -81,12 +81,12 @@ pub fn handle_expand_macro( | |||
81 | 81 | ||
82 | pub fn handle_selection_range( | 82 | pub fn handle_selection_range( |
83 | world: WorldSnapshot, | 83 | world: WorldSnapshot, |
84 | params: req::SelectionRangeParams, | 84 | params: lsp_types::SelectionRangeParams, |
85 | ) -> Result<Option<Vec<req::SelectionRange>>> { | 85 | ) -> Result<Option<Vec<lsp_types::SelectionRange>>> { |
86 | let _p = profile("handle_selection_range"); | 86 | let _p = profile("handle_selection_range"); |
87 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 87 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
88 | let line_index = world.analysis().file_line_index(file_id)?; | 88 | let line_index = world.analysis().file_line_index(file_id)?; |
89 | let res: Result<Vec<req::SelectionRange>> = params | 89 | let res: Result<Vec<lsp_types::SelectionRange>> = params |
90 | .positions | 90 | .positions |
91 | .into_iter() | 91 | .into_iter() |
92 | .map(|position| { | 92 | .map(|position| { |
@@ -105,12 +105,12 @@ pub fn handle_selection_range( | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | } | 107 | } |
108 | let mut range = req::SelectionRange { | 108 | let mut range = lsp_types::SelectionRange { |
109 | range: to_proto::range(&line_index, *ranges.last().unwrap()), | 109 | range: to_proto::range(&line_index, *ranges.last().unwrap()), |
110 | parent: None, | 110 | parent: None, |
111 | }; | 111 | }; |
112 | for &r in ranges.iter().rev().skip(1) { | 112 | for &r in ranges.iter().rev().skip(1) { |
113 | range = req::SelectionRange { | 113 | range = lsp_types::SelectionRange { |
114 | range: to_proto::range(&line_index, r), | 114 | range: to_proto::range(&line_index, r), |
115 | parent: Some(Box::new(range)), | 115 | parent: Some(Box::new(range)), |
116 | } | 116 | } |
@@ -156,7 +156,7 @@ pub fn handle_join_lines( | |||
156 | 156 | ||
157 | pub fn handle_on_enter( | 157 | pub fn handle_on_enter( |
158 | world: WorldSnapshot, | 158 | world: WorldSnapshot, |
159 | params: req::TextDocumentPositionParams, | 159 | params: lsp_types::TextDocumentPositionParams, |
160 | ) -> Result<Option<req::SourceChange>> { | 160 | ) -> Result<Option<req::SourceChange>> { |
161 | let _p = profile("handle_on_enter"); | 161 | let _p = profile("handle_on_enter"); |
162 | let position = from_proto::file_position(&world, params)?; | 162 | let position = from_proto::file_position(&world, params)?; |
@@ -169,7 +169,7 @@ pub fn handle_on_enter( | |||
169 | // Don't forget to add new trigger characters to `ServerCapabilities` in `caps.rs`. | 169 | // Don't forget to add new trigger characters to `ServerCapabilities` in `caps.rs`. |
170 | pub fn handle_on_type_formatting( | 170 | pub fn handle_on_type_formatting( |
171 | world: WorldSnapshot, | 171 | world: WorldSnapshot, |
172 | params: req::DocumentOnTypeFormattingParams, | 172 | params: lsp_types::DocumentOnTypeFormattingParams, |
173 | ) -> Result<Option<Vec<TextEdit>>> { | 173 | ) -> Result<Option<Vec<TextEdit>>> { |
174 | let _p = profile("handle_on_type_formatting"); | 174 | let _p = profile("handle_on_type_formatting"); |
175 | let mut position = from_proto::file_position(&world, params.text_document_position)?; | 175 | let mut position = from_proto::file_position(&world, params.text_document_position)?; |
@@ -208,8 +208,8 @@ pub fn handle_on_type_formatting( | |||
208 | 208 | ||
209 | pub fn handle_document_symbol( | 209 | pub fn handle_document_symbol( |
210 | world: WorldSnapshot, | 210 | world: WorldSnapshot, |
211 | params: req::DocumentSymbolParams, | 211 | params: lsp_types::DocumentSymbolParams, |
212 | ) -> Result<Option<req::DocumentSymbolResponse>> { | 212 | ) -> Result<Option<lsp_types::DocumentSymbolResponse>> { |
213 | let _p = profile("handle_document_symbol"); | 213 | let _p = profile("handle_document_symbol"); |
214 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 214 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
215 | let line_index = world.analysis().file_line_index(file_id)?; | 215 | let line_index = world.analysis().file_line_index(file_id)?; |
@@ -276,7 +276,7 @@ pub fn handle_document_symbol( | |||
276 | 276 | ||
277 | pub fn handle_workspace_symbol( | 277 | pub fn handle_workspace_symbol( |
278 | world: WorldSnapshot, | 278 | world: WorldSnapshot, |
279 | params: req::WorkspaceSymbolParams, | 279 | params: lsp_types::WorkspaceSymbolParams, |
280 | ) -> Result<Option<Vec<SymbolInformation>>> { | 280 | ) -> Result<Option<Vec<SymbolInformation>>> { |
281 | let _p = profile("handle_workspace_symbol"); | 281 | let _p = profile("handle_workspace_symbol"); |
282 | let all_symbols = params.query.contains('#'); | 282 | let all_symbols = params.query.contains('#'); |
@@ -320,8 +320,8 @@ pub fn handle_workspace_symbol( | |||
320 | 320 | ||
321 | pub fn handle_goto_definition( | 321 | pub fn handle_goto_definition( |
322 | world: WorldSnapshot, | 322 | world: WorldSnapshot, |
323 | params: req::GotoDefinitionParams, | 323 | params: lsp_types::GotoDefinitionParams, |
324 | ) -> Result<Option<req::GotoDefinitionResponse>> { | 324 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { |
325 | let _p = profile("handle_goto_definition"); | 325 | let _p = profile("handle_goto_definition"); |
326 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 326 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
327 | let nav_info = match world.analysis().goto_definition(position)? { | 327 | let nav_info = match world.analysis().goto_definition(position)? { |
@@ -338,8 +338,8 @@ pub fn handle_goto_definition( | |||
338 | 338 | ||
339 | pub fn handle_goto_implementation( | 339 | pub fn handle_goto_implementation( |
340 | world: WorldSnapshot, | 340 | world: WorldSnapshot, |
341 | params: req::GotoImplementationParams, | 341 | params: lsp_types::request::GotoImplementationParams, |
342 | ) -> Result<Option<req::GotoImplementationResponse>> { | 342 | ) -> Result<Option<lsp_types::request::GotoImplementationResponse>> { |
343 | let _p = profile("handle_goto_implementation"); | 343 | let _p = profile("handle_goto_implementation"); |
344 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 344 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
345 | let nav_info = match world.analysis().goto_implementation(position)? { | 345 | let nav_info = match world.analysis().goto_implementation(position)? { |
@@ -356,8 +356,8 @@ pub fn handle_goto_implementation( | |||
356 | 356 | ||
357 | pub fn handle_goto_type_definition( | 357 | pub fn handle_goto_type_definition( |
358 | world: WorldSnapshot, | 358 | world: WorldSnapshot, |
359 | params: req::GotoTypeDefinitionParams, | 359 | params: lsp_types::request::GotoTypeDefinitionParams, |
360 | ) -> Result<Option<req::GotoTypeDefinitionResponse>> { | 360 | ) -> Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> { |
361 | let _p = profile("handle_goto_type_definition"); | 361 | let _p = profile("handle_goto_type_definition"); |
362 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 362 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
363 | let nav_info = match world.analysis().goto_type_definition(position)? { | 363 | let nav_info = match world.analysis().goto_type_definition(position)? { |
@@ -374,7 +374,7 @@ pub fn handle_goto_type_definition( | |||
374 | 374 | ||
375 | pub fn handle_parent_module( | 375 | pub fn handle_parent_module( |
376 | world: WorldSnapshot, | 376 | world: WorldSnapshot, |
377 | params: req::TextDocumentPositionParams, | 377 | params: lsp_types::TextDocumentPositionParams, |
378 | ) -> Result<Vec<Location>> { | 378 | ) -> Result<Vec<Location>> { |
379 | let _p = profile("handle_parent_module"); | 379 | let _p = profile("handle_parent_module"); |
380 | let position = from_proto::file_position(&world, params)?; | 380 | let position = from_proto::file_position(&world, params)?; |
@@ -447,8 +447,8 @@ pub fn handle_runnables( | |||
447 | 447 | ||
448 | pub fn handle_completion( | 448 | pub fn handle_completion( |
449 | world: WorldSnapshot, | 449 | world: WorldSnapshot, |
450 | params: req::CompletionParams, | 450 | params: lsp_types::CompletionParams, |
451 | ) -> Result<Option<req::CompletionResponse>> { | 451 | ) -> Result<Option<lsp_types::CompletionResponse>> { |
452 | let _p = profile("handle_completion"); | 452 | let _p = profile("handle_completion"); |
453 | let position = from_proto::file_position(&world, params.text_document_position)?; | 453 | let position = from_proto::file_position(&world, params.text_document_position)?; |
454 | let completion_triggered_after_single_colon = { | 454 | let completion_triggered_after_single_colon = { |
@@ -506,8 +506,8 @@ pub fn handle_folding_range( | |||
506 | 506 | ||
507 | pub fn handle_signature_help( | 507 | pub fn handle_signature_help( |
508 | world: WorldSnapshot, | 508 | world: WorldSnapshot, |
509 | params: req::SignatureHelpParams, | 509 | params: lsp_types::SignatureHelpParams, |
510 | ) -> Result<Option<req::SignatureHelp>> { | 510 | ) -> Result<Option<lsp_types::SignatureHelp>> { |
511 | let _p = profile("handle_signature_help"); | 511 | let _p = profile("handle_signature_help"); |
512 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 512 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
513 | let call_info = match world.analysis().call_info(position)? { | 513 | let call_info = match world.analysis().call_info(position)? { |
@@ -521,14 +521,14 @@ pub fn handle_signature_help( | |||
521 | } | 521 | } |
522 | let sig_info = to_proto::signature_information(call_info.signature, concise); | 522 | let sig_info = to_proto::signature_information(call_info.signature, concise); |
523 | 523 | ||
524 | Ok(Some(req::SignatureHelp { | 524 | Ok(Some(lsp_types::SignatureHelp { |
525 | signatures: vec![sig_info], | 525 | signatures: vec![sig_info], |
526 | active_signature: Some(0), | 526 | active_signature: Some(0), |
527 | active_parameter, | 527 | active_parameter, |
528 | })) | 528 | })) |
529 | } | 529 | } |
530 | 530 | ||
531 | pub fn handle_hover(world: WorldSnapshot, params: req::HoverParams) -> Result<Option<Hover>> { | 531 | pub fn handle_hover(world: WorldSnapshot, params: lsp_types::HoverParams) -> Result<Option<Hover>> { |
532 | let _p = profile("handle_hover"); | 532 | let _p = profile("handle_hover"); |
533 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 533 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
534 | let info = match world.analysis().hover(position)? { | 534 | let info = match world.analysis().hover(position)? { |
@@ -549,7 +549,7 @@ pub fn handle_hover(world: WorldSnapshot, params: req::HoverParams) -> Result<Op | |||
549 | 549 | ||
550 | pub fn handle_prepare_rename( | 550 | pub fn handle_prepare_rename( |
551 | world: WorldSnapshot, | 551 | world: WorldSnapshot, |
552 | params: req::TextDocumentPositionParams, | 552 | params: lsp_types::TextDocumentPositionParams, |
553 | ) -> Result<Option<PrepareRenameResponse>> { | 553 | ) -> Result<Option<PrepareRenameResponse>> { |
554 | let _p = profile("handle_prepare_rename"); | 554 | let _p = profile("handle_prepare_rename"); |
555 | let position = from_proto::file_position(&world, params)?; | 555 | let position = from_proto::file_position(&world, params)?; |
@@ -589,7 +589,7 @@ pub fn handle_rename(world: WorldSnapshot, params: RenameParams) -> Result<Optio | |||
589 | 589 | ||
590 | pub fn handle_references( | 590 | pub fn handle_references( |
591 | world: WorldSnapshot, | 591 | world: WorldSnapshot, |
592 | params: req::ReferenceParams, | 592 | params: lsp_types::ReferenceParams, |
593 | ) -> Result<Option<Vec<Location>>> { | 593 | ) -> Result<Option<Vec<Location>>> { |
594 | let _p = profile("handle_references"); | 594 | let _p = profile("handle_references"); |
595 | let position = from_proto::file_position(&world, params.text_document_position)?; | 595 | let position = from_proto::file_position(&world, params.text_document_position)?; |
@@ -692,7 +692,7 @@ pub fn handle_formatting( | |||
692 | 692 | ||
693 | pub fn handle_code_action( | 693 | pub fn handle_code_action( |
694 | world: WorldSnapshot, | 694 | world: WorldSnapshot, |
695 | params: req::CodeActionParams, | 695 | params: lsp_types::CodeActionParams, |
696 | ) -> Result<Option<CodeActionResponse>> { | 696 | ) -> Result<Option<CodeActionResponse>> { |
697 | let _p = profile("handle_code_action"); | 697 | let _p = profile("handle_code_action"); |
698 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 698 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
@@ -806,7 +806,7 @@ pub fn handle_code_action( | |||
806 | 806 | ||
807 | pub fn handle_code_lens( | 807 | pub fn handle_code_lens( |
808 | world: WorldSnapshot, | 808 | world: WorldSnapshot, |
809 | params: req::CodeLensParams, | 809 | params: lsp_types::CodeLensParams, |
810 | ) -> Result<Option<Vec<CodeLens>>> { | 810 | ) -> Result<Option<Vec<CodeLens>>> { |
811 | let _p = profile("handle_code_lens"); | 811 | let _p = profile("handle_code_lens"); |
812 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 812 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
@@ -875,8 +875,8 @@ pub fn handle_code_lens( | |||
875 | .map(|it| { | 875 | .map(|it| { |
876 | let range = to_proto::range(&line_index, it.node_range); | 876 | let range = to_proto::range(&line_index, it.node_range); |
877 | let pos = range.start; | 877 | let pos = range.start; |
878 | let lens_params = req::GotoImplementationParams { | 878 | let lens_params = lsp_types::request::GotoImplementationParams { |
879 | text_document_position_params: req::TextDocumentPositionParams::new( | 879 | text_document_position_params: lsp_types::TextDocumentPositionParams::new( |
880 | params.text_document.clone(), | 880 | params.text_document.clone(), |
881 | pos, | 881 | pos, |
882 | ), | 882 | ), |
@@ -897,7 +897,7 @@ pub fn handle_code_lens( | |||
897 | #[derive(Debug, Serialize, Deserialize)] | 897 | #[derive(Debug, Serialize, Deserialize)] |
898 | #[serde(rename_all = "camelCase")] | 898 | #[serde(rename_all = "camelCase")] |
899 | enum CodeLensResolveData { | 899 | enum CodeLensResolveData { |
900 | Impls(req::GotoImplementationParams), | 900 | Impls(lsp_types::request::GotoImplementationParams), |
901 | } | 901 | } |
902 | 902 | ||
903 | pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Result<CodeLens> { | 903 | pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Result<CodeLens> { |
@@ -908,9 +908,9 @@ pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Re | |||
908 | Some(CodeLensResolveData::Impls(lens_params)) => { | 908 | Some(CodeLensResolveData::Impls(lens_params)) => { |
909 | let locations: Vec<Location> = | 909 | let locations: Vec<Location> = |
910 | match handle_goto_implementation(world, lens_params.clone())? { | 910 | match handle_goto_implementation(world, lens_params.clone())? { |
911 | Some(req::GotoDefinitionResponse::Scalar(loc)) => vec![loc], | 911 | Some(lsp_types::GotoDefinitionResponse::Scalar(loc)) => vec![loc], |
912 | Some(req::GotoDefinitionResponse::Array(locs)) => locs, | 912 | Some(lsp_types::GotoDefinitionResponse::Array(locs)) => locs, |
913 | Some(req::GotoDefinitionResponse::Link(links)) => links | 913 | Some(lsp_types::GotoDefinitionResponse::Link(links)) => links |
914 | .into_iter() | 914 | .into_iter() |
915 | .map(|link| Location::new(link.target_uri, link.target_selection_range)) | 915 | .map(|link| Location::new(link.target_uri, link.target_selection_range)) |
916 | .collect(), | 916 | .collect(), |
@@ -947,7 +947,7 @@ pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Re | |||
947 | 947 | ||
948 | pub fn handle_document_highlight( | 948 | pub fn handle_document_highlight( |
949 | world: WorldSnapshot, | 949 | world: WorldSnapshot, |
950 | params: req::DocumentHighlightParams, | 950 | params: lsp_types::DocumentHighlightParams, |
951 | ) -> Result<Option<Vec<DocumentHighlight>>> { | 951 | ) -> Result<Option<Vec<DocumentHighlight>>> { |
952 | let _p = profile("handle_document_highlight"); | 952 | let _p = profile("handle_document_highlight"); |
953 | let position = from_proto::file_position(&world, params.text_document_position_params)?; | 953 | let position = from_proto::file_position(&world, params.text_document_position_params)?; |
diff --git a/crates/rust-analyzer/src/req.rs b/crates/rust-analyzer/src/req.rs index 0dae6bad4..aeb29370c 100644 --- a/crates/rust-analyzer/src/req.rs +++ b/crates/rust-analyzer/src/req.rs | |||
@@ -1,23 +1,10 @@ | |||
1 | //! Defines `rust-analyzer` specific custom messages. | 1 | //! Defines `rust-analyzer` specific custom messages. |
2 | 2 | ||
3 | use lsp_types::request::Request; | ||
3 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; | 4 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; |
4 | use rustc_hash::FxHashMap; | 5 | use rustc_hash::FxHashMap; |
5 | use serde::{Deserialize, Serialize}; | 6 | use serde::{Deserialize, Serialize}; |
6 | 7 | ||
7 | pub use lsp_types::{ | ||
8 | notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, | ||
9 | CodeLensParams, CompletionParams, CompletionResponse, ConfigurationItem, ConfigurationParams, | ||
10 | DiagnosticTag, DidChangeConfigurationParams, DidChangeWatchedFilesParams, | ||
11 | DidChangeWatchedFilesRegistrationOptions, DocumentHighlightParams, | ||
12 | DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse, | ||
13 | FileSystemWatcher, GotoDefinitionParams, GotoDefinitionResponse, Hover, HoverParams, | ||
14 | InitializeResult, MessageType, PartialResultParams, ProgressParams, ProgressParamsValue, | ||
15 | ProgressToken, PublishDiagnosticsParams, ReferenceParams, Registration, RegistrationParams, | ||
16 | SelectionRange, SelectionRangeParams, SemanticTokensParams, SemanticTokensRangeParams, | ||
17 | SemanticTokensRangeResult, SemanticTokensResult, ServerCapabilities, ShowMessageParams, | ||
18 | SignatureHelp, SignatureHelpParams, SymbolKind, TextDocumentEdit, TextDocumentPositionParams, | ||
19 | TextEdit, WorkDoneProgressParams, WorkspaceEdit, WorkspaceSymbolParams, | ||
20 | }; | ||
21 | use std::path::PathBuf; | 8 | use std::path::PathBuf; |
22 | 9 | ||
23 | pub enum AnalyzerStatus {} | 10 | pub enum AnalyzerStatus {} |
@@ -91,7 +78,7 @@ pub struct FindMatchingBraceParams { | |||
91 | pub enum ParentModule {} | 78 | pub enum ParentModule {} |
92 | 79 | ||
93 | impl Request for ParentModule { | 80 | impl Request for ParentModule { |
94 | type Params = TextDocumentPositionParams; | 81 | type Params = lsp_types::TextDocumentPositionParams; |
95 | type Result = Vec<Location>; | 82 | type Result = Vec<Location>; |
96 | const METHOD: &'static str = "rust-analyzer/parentModule"; | 83 | const METHOD: &'static str = "rust-analyzer/parentModule"; |
97 | } | 84 | } |
@@ -114,7 +101,7 @@ pub struct JoinLinesParams { | |||
114 | pub enum OnEnter {} | 101 | pub enum OnEnter {} |
115 | 102 | ||
116 | impl Request for OnEnter { | 103 | impl Request for OnEnter { |
117 | type Params = TextDocumentPositionParams; | 104 | type Params = lsp_types::TextDocumentPositionParams; |
118 | type Result = Option<SourceChange>; | 105 | type Result = Option<SourceChange>; |
119 | const METHOD: &'static str = "rust-analyzer/onEnter"; | 106 | const METHOD: &'static str = "rust-analyzer/onEnter"; |
120 | } | 107 | } |
@@ -150,8 +137,8 @@ pub struct Runnable { | |||
150 | #[serde(rename_all = "camelCase")] | 137 | #[serde(rename_all = "camelCase")] |
151 | pub struct SourceChange { | 138 | pub struct SourceChange { |
152 | pub label: String, | 139 | pub label: String, |
153 | pub workspace_edit: WorkspaceEdit, | 140 | pub workspace_edit: lsp_types::WorkspaceEdit, |
154 | pub cursor_position: Option<TextDocumentPositionParams>, | 141 | pub cursor_position: Option<lsp_types::TextDocumentPositionParams>, |
155 | } | 142 | } |
156 | 143 | ||
157 | pub enum InlayHints {} | 144 | pub enum InlayHints {} |