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
20 Request:ShowTextDocumentRequest,
21) -> Result<Response<ShowTextDocumentResponse>, Status> {
22 let URI = Request.uri.as_ref().map(|U| U.value.clone()).unwrap_or_default();
23
24 dev_log!("cocoon", "[CocoonService] show_text_document: {}", URI);
25
26 let _ = Service.environment.ApplicationHandle.emit(
27 "sky://editor/openDocument",
28 json!({ "uri": URI, "viewColumn": Request.view_column }),
29 );
30
31 Ok(Response::new(ShowTextDocumentResponse { success:true }))
32}