Skip to main content

Mountain/RPC/CocoonService/Provider/
ProvideCallHierarchyOutgoingCalls.rs

1//! Forward a call hierarchy outgoing request to the registered provider.
2
3use serde_json::json;
4use tonic::{Response, Status};
5use CommonLibrary::LanguageFeature::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
6use ::Vine::Generated::{ProvideCallHierarchyRequest, ProvideCallHierarchyResponse};
7
8use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
9
10pub async fn Fn(
11	Service:&CocoonServiceImpl,
12
13	Request:ProvideCallHierarchyRequest,
14) -> Result<Response<ProvideCallHierarchyResponse>, Status> {
15	dev_log!("cocoon", "[CocoonService] Providing call hierarchy outgoing");
16
17	let ItemDTO = json!({
18		"name": Request.item.as_ref().map(|I| I.name.as_str()).unwrap_or(""),
19		"uri": Request.uri.as_ref().map(|U| U.value.as_str()).unwrap_or(""),
20	});
21
22	match Service.environment.ProvideCallHierarchyOutgoingCalls(ItemDTO).await {
23		Ok(_) => Ok(Response::new(<ProvideCallHierarchyResponse>::default())),
24
25		Err(Error) => Err(Status::internal(format!("call hierarchy outgoing failed: {}", Error))),
26	}
27}