Skip to main content

Mountain/RPC/CocoonService/Provider/
ProvideCallHierarchyIncomingCalls.rs

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