package coq-lsp
Language Server Protocol native server for Coq
Install
Dune Dependency
Authors
Maintainers
Sources
coq-lsp-0.1.8.8.19.tbz
sha256=1e63289d620e533615812267e96e44c1b5cd2dbdaf26cc9dc8ba00051c2b08c0
sha512=9f5e25c6974d293e7c073e65f85936ef18180692dd031c7b709d24d3eefb1955e955c6208cf02c2ac70fa12966d96bc1d43b29f55c425274802289dcf66d5eb2
doc/src/coq-lsp.lsp/jLang.ml.html
Source file jLang.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
(************************************************************************) (* Coq Language Server Protocol *) (* Copyright 2019 MINES ParisTech -- LGPL 2.1+ *) (* Copyright 2019-2023 Inria -- LGPL 2.1+ *) (* Written by: Emilio J. Gallego Arias *) (************************************************************************) module Pp = JCoq.Pp module Point = struct type t = [%import: Lang.Point.t] [@@deriving yojson] end module Range = struct type t = [%import: (Lang.Range.t[@with Lang.Point.t := Point.t])] [@@deriving yojson] end module LUri = struct module File = struct type t = Lang.LUri.File.t let to_yojson uri = `String (Lang.LUri.File.to_string_uri uri) let invalid_uri msg obj = raise (Yojson.Safe.Util.Type_error (msg, obj)) let of_yojson uri = match uri with | `String uri as obj -> ( let uri = Lang.LUri.of_string uri in match Lang.LUri.File.of_uri uri with | Result.Ok t -> Result.Ok t | Result.Error msg -> invalid_uri ("failed to parse uri: " ^ msg) obj) | obj -> invalid_uri "expected uri string, got json object" obj end end module Diagnostic = struct module Libnames = Serlib.Ser_libnames (* LSP Ranges, a bit different from Fleche's ranges as points don't include offsets *) module Point = struct type t = { line : int ; character : int } [@@deriving yojson] let conv { Lang.Point.line; character; offset = _ } = { line; character } end module Range = struct type t = { start : Point.t ; end_ : Point.t [@key "end"] } [@@deriving yojson] let conv { Lang.Range.start; end_ } = let start = Point.conv start in let end_ = Point.conv end_ in { start; end_ } end (* Current Flèche diagnostic is not LSP-standard compliant, this one is *) type t = Lang.Diagnostic.t type _t = { range : Range.t ; severity : int ; message : string } [@@deriving yojson] let to_yojson { Lang.Diagnostic.range; severity; message; extra = _ } = let message = Pp.to_string message in let range = Range.conv range in _t_to_yojson { range; severity; message } end let mk_diagnostics ~uri ~version ld : Yojson.Safe.t = let diags = List.map Diagnostic.to_yojson ld in let uri = Lang.LUri.File.to_string_uri uri in let params = `Assoc [ ("uri", `String uri) ; ("version", `Int version) ; ("diagnostics", `List diags) ] in Base.mk_notification ~method_:"textDocument/publishDiagnostics" ~params
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>