From 256ec6e8d4ac46b2569713d2ffe92d102595f5d2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 18:27:44 +0300 Subject: introduce CallInfo --- crates/ra_lsp_server/src/main_loop/handlers.rs | 28 ++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop') 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( params: req::TextDocumentPositionParams, ) -> Result> { let position = params.try_conv_with(&world)?; - - if let Some((descriptor, active_param)) = world.analysis().resolve_callable(position)? { - let parameters: Vec = descriptor - .params - .iter() + if let Some(call_info) = world.analysis().call_info(position)? { + let parameters: Vec = call_info + .parameters + .into_iter() .map(|param| ParameterInformation { label: ParameterLabel::Simple(param.clone()), documentation: None, }) .collect(); - - let documentation = if let Some(doc) = descriptor.doc { - Some(Documentation::MarkupContent(MarkupContent { + let documentation = call_info.doc.map(|value| { + Documentation::MarkupContent(MarkupContent { kind: MarkupKind::Markdown, - value: doc, - })) - } else { - None - }; - + value, + }) + }); let sig_info = SignatureInformation { - label: descriptor.label, + label: call_info.label, documentation, parameters: Some(parameters), }; - Ok(Some(req::SignatureHelp { signatures: vec![sig_info], active_signature: Some(0), - active_parameter: active_param.map(|a| a as u64), + active_parameter: call_info.active_parameter.map(|it| it as u64), })) } else { Ok(None) -- cgit v1.2.3