Skip to main content

Mountain/RPC/CocoonService/Provider/
ProvideCallHierarchyIncomingCalls.rs

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