diff options
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 99f15354f..b9b42f1b3 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -475,36 +475,30 @@ pub fn handle_signature_help( | |||
475 | params: req::TextDocumentPositionParams, | 475 | params: req::TextDocumentPositionParams, |
476 | ) -> Result<Option<req::SignatureHelp>> { | 476 | ) -> Result<Option<req::SignatureHelp>> { |
477 | let position = params.try_conv_with(&world)?; | 477 | let position = params.try_conv_with(&world)?; |
478 | 478 | if let Some(call_info) = world.analysis().call_info(position)? { | |
479 | if let Some((descriptor, active_param)) = world.analysis().resolve_callable(position)? { | 479 | let parameters: Vec<ParameterInformation> = call_info |
480 | let parameters: Vec<ParameterInformation> = descriptor | 480 | .parameters |
481 | .params | 481 | .into_iter() |
482 | .iter() | ||
483 | .map(|param| ParameterInformation { | 482 | .map(|param| ParameterInformation { |
484 | label: ParameterLabel::Simple(param.clone()), | 483 | label: ParameterLabel::Simple(param.clone()), |
485 | documentation: None, | 484 | documentation: None, |
486 | }) | 485 | }) |
487 | .collect(); | 486 | .collect(); |
488 | 487 | let documentation = call_info.doc.map(|value| { | |
489 | let documentation = if let Some(doc) = descriptor.doc { | 488 | Documentation::MarkupContent(MarkupContent { |
490 | Some(Documentation::MarkupContent(MarkupContent { | ||
491 | kind: MarkupKind::Markdown, | 489 | kind: MarkupKind::Markdown, |
492 | value: doc, | 490 | value, |
493 | })) | 491 | }) |
494 | } else { | 492 | }); |
495 | None | ||
496 | }; | ||
497 | |||
498 | let sig_info = SignatureInformation { | 493 | let sig_info = SignatureInformation { |
499 | label: descriptor.label, | 494 | label: call_info.label, |
500 | documentation, | 495 | documentation, |
501 | parameters: Some(parameters), | 496 | parameters: Some(parameters), |
502 | }; | 497 | }; |
503 | |||
504 | Ok(Some(req::SignatureHelp { | 498 | Ok(Some(req::SignatureHelp { |
505 | signatures: vec![sig_info], | 499 | signatures: vec![sig_info], |
506 | active_signature: Some(0), | 500 | active_signature: Some(0), |
507 | active_parameter: active_param.map(|a| a as u64), | 501 | active_parameter: call_info.active_parameter.map(|it| it as u64), |
508 | })) | 502 | })) |
509 | } else { | 503 | } else { |
510 | Ok(None) | 504 | Ok(None) |