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