package linol
LSP server library
Install
Dune Dependency
Authors
Maintainers
Sources
linol-0.10.tbz
sha256=174bb8cad5b8b0c260d62b0a85da13c4f5caba4fcee042ee58284b09de7896ea
sha512=77460788407c72a33fbe289ec9c78421117543594b3524a5c8fe836f0e272c5ceb1e1074b91c1d1f476f89b75b6f63847a8021675a782ff36457c9626121a7f4
doc/src/linol.lsp/cli.ml.html
Source file cli.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
module Channel = struct type t = | Stdio | Pipe of string | Socket of int end module Arg = struct type t = { mutable pipe : string option ; mutable port : int option ; mutable stdio : bool ; mutable spec : (string * Arg.spec * string) list ; mutable clientProcessId : int option } let port t ~name ~description = ( name , Arg.Int (fun p -> match t.port with | Some _ -> raise @@ Arg.Bad "port is already set once" | None -> t.port <- Some p) , description ) ;; let create () = let t = { pipe = None; port = None; stdio = false; spec = []; clientProcessId = None } in let spec = [ "--pipe", Arg.String (fun p -> t.pipe <- Some p), "set pipe path" ; port t ~name:"--socket" ~description:"set the port" ; port t ~name:"--port" ~description:"synonym for --socket" ; "--stdio", Arg.Unit (fun () -> t.stdio <- true), "set stdio" ; ( "--node-ipc" , Arg.Unit (fun () -> raise @@ Arg.Bad "node-ipc isn't supported") , "not supported" ) ; ( "--clientProcessId" , Arg.Int (fun pid -> t.clientProcessId <- Some pid) , "set the pid of the lsp client" ) ] in t.spec <- spec; t ;; let spec t = t.spec let clientProcessId t = t.clientProcessId let channel { pipe; port; stdio; spec = _; clientProcessId = _ } : (Channel.t, string) result = match pipe, port, stdio with | None, None, _ -> Ok Stdio | Some p, None, false -> Ok (Pipe p) | None, Some s, false -> Ok (Socket s) | _, _, _ -> Error "invalid arguments" ;; end let args ?channel ?clientProcessId () = let args = match clientProcessId with | None -> [] | Some pid -> [ "--clientProcessId"; string_of_int pid ] in match (channel : Channel.t option) with | None -> args | Some Stdio -> "--stdio" :: args | Some (Pipe pipe) -> "--pipe" :: pipe :: args | Some (Socket port) -> "--socket" :: string_of_int port :: args ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>