Mountain/RPC/CocoonService/Window/
ShowTextDocument.rs1
2use serde_json::json;
7use tauri::Emitter;
8use tonic::{Response, Status};
9
10use crate::{
11 RPC::CocoonService::CocoonServiceImpl,
12 Vine::Generated::{ShowTextDocumentRequest, ShowTextDocumentResponse},
13 dev_log,
14};
15
16pub async fn Fn(
17 Service:&CocoonServiceImpl,
18
19 Request:ShowTextDocumentRequest,
20) -> Result<Response<ShowTextDocumentResponse>, Status> {
21 let URI = Request.uri.as_ref().map(|U| U.value.clone()).unwrap_or_default();
22
23 dev_log!("cocoon", "[CocoonService] show_text_document: {}", URI);
24
25 let _ = Service.environment.ApplicationHandle.emit(
26 "sky://editor/openDocument",
27 json!({ "uri": URI, "viewColumn": Request.view_column }),
28 );
29
30 Ok(Response::new(ShowTextDocumentResponse { success:true }))
31}