package coq-lsp
Language Server Protocol native server for Coq
Install
Dune Dependency
Authors
Maintainers
Sources
coq-lsp-0.2.0.8.18.tbz
sha256=ba40f92f4c751793265d20f1c217638146e4714e0196a0d2b00c9ed58774abf6
sha512=0b7c1d98e22017e44d90461ee61081043401387251488ee7113668d24f6a463dca4ce690e30355248a949817c6b8f8a0944489c4d9b66bd239d903a089a1f11f
doc/src/petanque_json/interp.ml.html
Source file interp.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
(************************************************************************) (* Coq Petanque *) (* Copyright 2019 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *) (* Copyright 2019-2024 Inria -- Dual License LGPL 2.1 / GPL3+ *) (************************************************************************) open Protocol module A = Petanque.Agent (* These types ares basically duplicated with controller/request.ml; move to a common lib (lsp?) *) type 'a r = ('a, int * string) Result.t module Action = struct type t = | Now of (token:Coq.Limits.Token.t -> Yojson.Safe.t r) | Doc of { uri : Lang.LUri.File.t ; handler : token:Coq.Limits.Token.t -> doc:Fleche.Doc.t -> Yojson.Safe.t r } end (* End of controller/request.ml *) let of_pet_err res = Result.map_error (fun err -> let message = Petanque.Agent.Error.to_string err in let code = Petanque.Agent.Error.to_code err in (code, message)) res (* Basically a functor from R.Handler.t to Action.t, but closing over params *) let do_request (module R : Protocol.Request.S) ~params = let of_pet res = Result.map R.Handler.Response.to_yojson res |> of_pet_err in let handler params = match R.Handler.handler with | Immediate handler -> Action.Now (fun ~token -> handler ~token params |> of_pet) | FullDoc { uri_fn; handler } -> let uri = uri_fn params in let handler ~token ~doc = handler ~token ~doc params |> of_pet in Action.Doc { uri; handler } in match R.Handler.Params.of_yojson (`Assoc params) with | Ok params -> handler params | Error message -> (* JSON-RPC Parse error *) let code = -32700 in Action.Now (fun ~token:_ -> Error (code, message)) type 'a handle = token:Coq.Limits.Token.t -> Action.t -> 'a let handle_request ~(do_handle : 'a handle) ~unhandled ~token ~method_ ~params = match method_ with | s when String.equal Start.method_ s -> do_handle ~token (do_request (module Start) ~params) | s when String.equal RunTac.method_ s -> do_handle ~token (do_request (module RunTac) ~params) | s when String.equal Goals.method_ s -> do_handle ~token (do_request (module Goals) ~params) | s when String.equal Premises.method_ s -> do_handle ~token (do_request (module Premises) ~params) | s when String.equal StateEqual.method_ s -> do_handle ~token (do_request (module StateEqual) ~params) | s when String.equal StateHash.method_ s -> do_handle ~token (do_request (module StateHash) ~params) | s when String.equal StateProofEqual.method_ s -> do_handle ~token (do_request (module StateProofEqual) ~params) | s when String.equal StateProofHash.method_ s -> do_handle ~token (do_request (module StateProofHash) ~params) | _ -> unhandled ~token ~method_
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>