package lsp
LSP protocol implementation in OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
jsonrpc-1.4.1.tbz
sha256=cee8371e7048e24c90e916c373ef6f3aba6f474d8a5fcf507ab6650fd8575eeb
sha512=150ebf71d3484d3beec1a145877cf30d84581bd072dd20159e878ed07cc4fc647b019b98bb0c9fede839b87f7bd13de4a64b534c0760a2ec57d0e4a4deac6f0f
doc/src/lsp.fiber_unix/fiber_stream.ml.html
Source file fiber_stream.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
module In = struct type 'a t = unit -> 'a option Fiber.t let create f = f let read t = t () let empty () () = Fiber.return None let of_list xs = let xs = ref xs in fun () -> match !xs with | [] -> Fiber.return None | x :: xs' -> xs := xs'; Fiber.return (Some x) let rec filter_map t ~f () = let open Fiber.O in let* next = read t in match next with | None -> Fiber.return None | Some x -> ( match f x with | None -> filter_map t ~f () | Some y -> Fiber.return (Some y) ) let map t ~f = filter_map t ~f:(fun x -> Some (f x)) let filter (type a) (t : a t) ~f : a t = filter_map t ~f:(fun x -> if f x then Some x else None) let rec sequential_iter t ~f = let open Fiber.O in let* e = t () in match e with | None -> Fiber.return () | Some x -> let* () = f x in sequential_iter t ~f end module Out = struct type 'a t = 'a option -> unit Fiber.t let create f = f let write f x = f x let of_ref ref = function | None -> Fiber.return () | Some x -> Fiber.return (ref := x :: !ref) let null () _ = Fiber.return () end let connect i o = let open Fiber.O in let rec go () = let* a = In.read i in let* () = Out.write o a in match a with | None -> Fiber.return () | Some _ -> go () in go () let supply i o = let open Fiber.O in let rec go () = let* a = In.read i in match a with | None -> Fiber.return () | Some _ -> let* () = Out.write o a in go () in go () let pipe () = let mvar = Fiber.Mvar.create () in let i = In.create (fun () -> Fiber.Mvar.read mvar) in let o = Out.create (fun x -> Fiber.Mvar.write mvar x) in (i, o)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>