package linol-eio
LSP server library (with Eio for concurrency)
Install
Dune Dependency
Authors
Maintainers
Sources
linol-0.9.tbz
sha256=7f3ef80e73a69289589a906990f18de52ce4a46e6447b30aea77f87aae677e63
sha512=713340015bee1807cd39e76048d8b30d6d24a4f262e3dfaacfe8726b52e1f8f93c5184a50485cfa657ff0ee66a813c7ec8bc812580dec489a5b81051e3ddb0e6
doc/src/linol-eio/linol_eio.ml.html
Source file linol_eio.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
module type IO = Linol.IO module IO_eio : IO with type 'a t = 'a and type env = Eio_unix.Stdenv.base and type in_channel = Eio.Buf_read.t and type out_channel = Eio_unix.sink_ty Eio.Std.r = struct type 'a t = 'a let ( let+ ) x f = f x let ( let* ) x f = f x let ( and+ ) a b = a, b let return x = x let failwith = failwith let fail = raise let catch f handler = try f () with exn -> let bt = Printexc.get_raw_backtrace () in handler exn bt let stdin env = Eio.Buf_read.of_flow ~max_size:1_000_000 (Eio.Stdenv.stdin env) let stdout = Eio.Stdenv.stdout type env = Eio_unix.Stdenv.base type in_channel = Eio.Buf_read.t type out_channel = Eio_unix.sink_ty Eio.Std.r let write_string out_ch str = Eio.Flow.copy_string str out_ch let write out_ch bytes off len = Eio.Buf_write.with_flow out_ch @@ fun w -> Eio.Buf_write.bytes w ~off ~len bytes let read in_ch bytes off len = let str = Eio.Buf_read.take len in_ch in Bytes.blit_string str off bytes 0 len let read_line in_ch = Eio.Buf_read.line in_ch end (** Spawn function. *) let spawn f = let promise, resolver = Eio.Promise.create () in (try f (); Eio.Promise.resolve_ok resolver () with exn -> Printf.eprintf "uncaught exception in `spawn`:\n%s\n%!" (Printexc.to_string exn); Eio.Promise.resolve_error resolver exn); Eio.Promise.await_exn promise include Lsp.Types include IO_eio type doc_state = Linol.Server.doc_state module Jsonrpc2 = Linol.Jsonrpc2.Make (IO_eio)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>