package coq-lsp
Language Server Protocol native server for Coq
Install
dune-project
Dependency
Authors
Maintainers
Sources
coq-lsp-0.2.4.8.20.tbz
sha256=9e3736371fe2c2dd5af50e2a360f070f8c329516c60f01ba3dc7378b80b77172
sha512=d5302f5dc4d7700910b7a7a2d1558770e15bfc0c7bcf9de2ccfd321b4e3cd591848d8e11f03e87362a8d81df72ec4af57dda2c3c5737b34726dcee35de2e56c8
doc/src/coq-lsp.lsp/jFleche.ml.html
Source file jFleche.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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) (************************************************************************) (* 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 Ast = JCoq.Ast module Lang = JLang module Names = Serlib.Ser_names module Config = struct module Completion = struct module Unicode = struct module Mode = struct type t = [%import: Fleche.Config.Completion.Unicode.Mode.t] let to_yojson = function | Off -> `String "off" | Internal_small -> `String "internal" | Normal -> `String "normal" | Extended -> `String "extended" let of_yojson (j : Yojson.Safe.t) : (t, string) Result.t = match j with | `String "off" -> Ok Off | `String "internal" -> Ok Internal_small | `String "normal" -> Ok Normal | `String "extended" -> Ok Extended | _ -> Error "Fleche.Config.Completion.Unicode.Mode.t: expected one of \ [off,normal,extended]" end let default_commit_chars = Fleche.Config.Completion.Unicode.default_commit_chars type t = [%import: Fleche.Config.Completion.Unicode.t] [@@deriving yojson] end let default = Fleche.Config.Completion.default type t = [%import: Fleche.Config.Completion.t] [@@deriving yojson] end type t = [%import: Fleche.Config.t] [@@deriving yojson] end module FileProgress = struct module Info = struct type t = [%import: Fleche.Progress.Info.t] [@@deriving yojson] end type t = { textDocument : Doc.VersionedTextDocumentIdentifier.t ; processing : Info.t list } [@@deriving yojson] end let mk_progress ~uri ~version processing = let textDocument = { Doc.VersionedTextDocumentIdentifier.uri; version } in let params = FileProgress.to_yojson { FileProgress.textDocument; processing } |> Yojson.Safe.Util.to_assoc in Base.Notification.make ~method_:"$/coq/fileProgress" ~params () module Message = struct type 'a t = { range : JLang.Range.t option ; level : int ; text : 'a } [@@deriving yojson] let of_coq_message (level, { Coq.Message.Payload.range; msg; quickFix = _ }) = { range; level; text = msg } let map ~f { range; level; text } = let text = f text in { range; level; text } end module GoalsAnswer = struct type ('goals, 'pp) t = { textDocument : Doc.VersionedTextDocumentIdentifier.t ; position : Lang.Point.t ; range : Lang.Range.t option [@default None] ; goals : ('goals, 'pp) JCoq.Goals.reified option [@default None] ; program : JCoq.Declare.OblState.View.t Names.Id.Map.t option [@default None] ; messages : 'pp Message.t list ; error : 'pp option [@default None] } [@@deriving yojson] end (** Pull Diagnostics *) module CompletionStatus = struct type t = { status : [ `Yes | `Stopped | `Failed ] ; range : Lang.Range.t } [@@deriving yojson] end module RangedSpan = struct type ('goals, 'pp) t = { range : Lang.Range.t ; ast : Ast.t option [@default None] ; goals : ('goals, 'pp) GoalsAnswer.t option [@default None] } [@@deriving yojson] end module FlecheDocument = struct type ('goals, 'pp) t = { spans : ('goals, 'pp) RangedSpan.t list ; completed : CompletionStatus.t } [@@deriving yojson] end module Info = struct type t = [%import: Fleche.Perf.Info.t] [@@deriving yojson] end module SentencePerfData = struct type t = [%import: Fleche.Perf.Sentence.t] [@@deriving yojson] end module DocumentPerfData = struct type t = { textDocument : Doc.VersionedTextDocumentIdentifier.t ; summary : string ; timings : SentencePerfData.t list } [@@deriving yojson] end let mk_perf ~uri ~version perf = let textDocument = { Doc.VersionedTextDocumentIdentifier.uri; version } in let params = let { Fleche.Perf.summary; timings } = perf in DocumentPerfData.( to_yojson { textDocument; summary; timings } |> Yojson.Safe.Util.to_assoc) in Base.Notification.make ~method_:"$/coq/filePerfData" ~params () module ServerVersion = struct type t = [%import: Fleche.ServerInfo.Version.t] [@@deriving yojson] end let mk_serverVersion vi = let params = ServerVersion.to_yojson vi |> Yojson.Safe.Util.to_assoc in Base.Notification.make ~method_:"$/coq/serverVersion" ~params () let mk_serverStatus (st : Fleche.ServerInfo.Status.t) = let params = match st with | Stopped -> [ ("status", `String "Stopped") ] | Idle mem -> [ ("status", `String "Idle"); ("mem", `String mem) ] | Running modname -> [ ("status", `String "Busy"); ("modname", `String modname) ] in Base.Notification.make ~method_:"$/coq/serverStatus" ~params () module ExecInfoParams = struct type t = { textDocument : Doc.VersionedTextDocumentIdentifier.t ; range : JLang.Range.t } [@@deriving yojson] end let mk_execinfo ~uri ~version ~range = let textDocument = { Doc.VersionedTextDocumentIdentifier.uri; version } in let params = ExecInfoParams.(to_yojson { textDocument; range }) |> Yojson.Safe.Util.to_assoc in Base.Notification.make ~method_:"$/coq/executionInformation" ~params ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>