package lsp
LSP protocol implementation in OCaml
Install
Dune Dependency
Authors
-
AAndrey Popp <8mayday@gmail.com>
-
RRusty Key <iam@stfoo.ru>
-
LLouis Roché <louis@louisroche.net>
-
OOleksiy Golovko <alexei.golovko@gmail.com>
-
RRudi Grinberg <me@rgrinberg.com>
-
SSacha Ayoun <sachaayoun@gmail.com>
-
Ccannorin <cannorin@gmail.com>
-
UUlugbek Abdullaev <ulugbekna@gmail.com>
-
Thibaut Mattio
-
MMax Lantas <mnxndev@outlook.com>
Maintainers
Sources
jsonrpc-1.10.3.tbz
sha256=a3ac1073b0728b94f4bdb0111772c0abaf7ff70324399450eab7156bfac151f1
sha512=bed6ddbde28088e43db0d40ab27056ba22537d19ffe8117a3da4c77676948f18708b06937dd2c972dce5c5822ea751c9c85cfa1ce3c1b3739460d4a24ebc2282
doc/src/lsp.stdune/env.ml.html
Source file env.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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
# 1 "submodules/dune/otherlibs/stdune/env.ml" module Var = struct module T = struct type t = string let compare = if Sys.win32 then fun a b -> String.compare (String.lowercase a) (String.lowercase b) else String.compare let to_dyn = Dyn.string end let temp_dir = if Sys.win32 then "TEMP" else "TMPDIR" include Comparable.Make (T) include T end module Set = Var.Set module Map = Var.Map (* The use of [mutable] here is safe, since we never call (back) to the memoization framework when computing [unix]. *) type t = { vars : string Map.t ; mutable unix : string list option } let equal t { vars; unix = _ } = Map.equal ~equal:String.equal t.vars vars let hash { vars; unix = _ } = Hashtbl.hash vars let make vars = { vars; unix = None } let empty = make Map.empty let vars t = Var.Set.of_keys t.vars let get t k = Map.find t.vars k let to_unix t = match t.unix with | Some v -> v | None -> let res = Map.foldi ~init:[] ~f:(fun k v acc -> Printf.sprintf "%s=%s" k v :: acc) t.vars in t.unix <- Some res; res let of_unix arr = Array.to_list arr |> List.map ~f:(fun s -> match String.lsplit2 s ~on:'=' with | None -> Code_error.raise "Env.of_unix: entry without '=' found in the environment" [ ("var", String s) ] | Some (k, v) -> (k, v)) |> Map.of_list_multi |> Map.map ~f:(function | [] -> assert false | x :: _ -> x) let initial = make (of_unix (Unix.environment ())) let of_unix u = make (of_unix u) let add t ~var ~value = make (Map.set t.vars var value) let remove t ~var = make (Map.remove t.vars var) let extend t ~vars = if Map.is_empty vars then t else make (Map.superpose t.vars vars) let extend_env x y = if Map.is_empty x.vars then y else extend x ~vars:y.vars let to_dyn t = let open Dyn in Map.to_dyn string t.vars let diff x y = Map.merge x.vars y.vars ~f:(fun _k vx vy -> match vy with | Some _ -> None | None -> vx) |> make let update t ~var ~f = make (Map.update t.vars var ~f) let of_string_map m = make (String.Map.foldi ~init:Map.empty ~f:(fun k v acc -> Map.set acc k v) m) let iter t = Map.iteri t.vars let cons_path t ~dir = make (Map.update t.vars "PATH" ~f:(fun _PATH -> Some (Bin.cons_path dir ~_PATH))) let path env = match get env "PATH" with | None -> [] | Some s -> Bin.parse_path s let to_map t = t.vars
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>