Mountain/RPC/CocoonService/GenericRequest/WindowDialogs/OpenDocument.rs
1use serde_json::{Value, json};
2use tauri::Emitter;
3use tonic::Response;
4use ::Vine::Generated::GenericResponse;
5
6use crate::Environment::MountainEnvironment::MountainEnvironment;
7
8pub fn Fn(RequestId:u64, Params:Value, Env:&MountainEnvironment) -> Response<GenericResponse> {
9 let Uri = Params
10 .get("uri")
11 .and_then(|V| V.get("value").or(Some(V)))
12 .and_then(|V| V.as_str())
13 .unwrap_or("")
14 .to_string();
15
16 let ViewColumn = Params.get("viewColumn").and_then(|V| V.as_i64());
17
18 let _ = Env
19 .ApplicationHandle
20 .emit("sky://editor/openDocument", json!({ "uri": Uri, "viewColumn": ViewColumn }));
21
22 super::super::FileSystem::OkResponse(RequestId, &json!({ "success": true }))
23}