1#![allow(unused)]
4
5use js_sys::{Function, Promise};
6use wasm_bindgen::prelude::*;
7
8use crate::LONG_VERSION;
9
10#[wasm_bindgen]
12pub fn version() -> String {
13 LONG_VERSION.clone()
14}
15
16#[wasm_bindgen]
18pub struct TinymistLanguageServer {
19 send_diagnostics: Function,
20 send_request: Function,
21 send_notification: Function,
22}
23
24#[wasm_bindgen]
25impl TinymistLanguageServer {
26 #[wasm_bindgen(constructor)]
28 pub fn new(
29 send_diagnostics: Function,
30 send_request: Function,
31 send_notification: Function,
32 ) -> Self {
33 std::panic::set_hook(Box::new(console_error_panic_hook::hook));
34
35 Self {
36 send_diagnostics,
37 send_request,
38 send_notification,
39 }
40 }
41
42 pub fn on_request(&self, method: String, js_params: JsValue) -> Result<JsValue, JsValue> {
44 todo!()
45 }
46
47 pub fn on_notification(&self, method: String, js_params: JsValue) -> Promise {
49 todo!()
50 }
51}