package vscoq-language-server
VSCoq language server
Install
Dune Dependency
Authors
Maintainers
Sources
vscoq-language-server-2.1.3.tar.gz
md5=300d171d3225fac2a68ce348154ff640
sha512=65bc228d84f814cfea4b5ddcd20f365a8a8ea178bbd4474129c998e8a351a7dba8d2adbb263f7f18ed41c45c765e73c332b518834360bf3638fe2721518e1fd8
doc/src/vscoq-language-server.lsp/extProtocol.ml.html
Source file extProtocol.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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
(**************************************************************************) (* *) (* VSCoq *) (* *) (* Copyright INRIA and contributors *) (* (see version control and README file for authors & dates) *) (* *) (**************************************************************************) (* *) (* This file is distributed under the terms of the MIT License. *) (* See LICENSE file. *) (* *) (**************************************************************************) open Lsp.Types open LspWrapper open Printing module Notification = struct module Client = struct module InterpretToPointParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; } [@@deriving yojson] end module InterpretToEndParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; } [@@deriving yojson] end module StepBackwardParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position: Position.t option; } [@@deriving yojson] end module StepForwardParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position: Position.t option; } [@@deriving yojson] end type t = | Std of Lsp.Client_notification.t | InterpretToEnd of InterpretToEndParams.t | InterpretToPoint of InterpretToPointParams.t | StepForward of StepForwardParams.t | StepBackward of StepBackwardParams.t let of_jsonrpc (Jsonrpc.Notification.{ method_; params } as notif) = let open Lsp.Import.Result.O in match method_ with | "vscoq/interpretToPoint" -> let+ params = Lsp.Import.Json.message_params params InterpretToPointParams.t_of_yojson in InterpretToPoint params | "vscoq/stepBackward" -> let+ params = Lsp.Import.Json.message_params params StepBackwardParams.t_of_yojson in StepBackward params | "vscoq/stepForward" -> let+ params = Lsp.Import.Json.message_params params StepForwardParams.t_of_yojson in StepForward params | "vscoq/interpretToEnd" -> let+ params = Lsp.Import.Json.message_params params InterpretToEndParams.t_of_yojson in InterpretToEnd params | _ -> let+ notif = Lsp.Client_notification.of_jsonrpc notif in Std notif end module Server = struct module MoveCursorParams = struct type t = { uri: DocumentUri.t; range: Range.t; } [@@deriving yojson] end module ProofViewParams = struct type t = { proof: ProofState.t option; messages: (DiagnosticSeverity.t * pp) list; } [@@deriving yojson] end type t = | Std of Lsp.Server_notification.t | UpdateHighlights of overview | MoveCursor of MoveCursorParams.t | ProofView of ProofViewParams.t | SearchResult of query_result let to_jsonrpc = function | Std notification -> Lsp.Server_notification.to_jsonrpc notification | UpdateHighlights params -> let method_ = "vscoq/updateHighlights" in let params = yojson_of_overview params in let params = Some (Jsonrpc.Structured.t_of_yojson params) in Jsonrpc.Notification.{ method_; params } | ProofView params -> let method_ = "vscoq/proofView" in let params = ProofViewParams.yojson_of_t params in let params = Some (Jsonrpc.Structured.t_of_yojson params) in Jsonrpc.Notification.{ method_; params } | SearchResult params -> let method_ = "vscoq/searchResult" in let params = yojson_of_query_result params in let params = Some (Jsonrpc.Structured.t_of_yojson params) in Jsonrpc.Notification.{ method_; params } | MoveCursor params -> let method_ = "vscoq/moveCursor" in let params = MoveCursorParams.yojson_of_t params in let params = Some (Jsonrpc.Structured.t_of_yojson params) in Jsonrpc.Notification.{ method_; params } end end module Request = struct module Client = struct module ResetParams = struct type t = { textDocument : TextDocumentIdentifier.t; } [@@deriving yojson] end module AboutParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; pattern : string; } [@@deriving yojson] end module CheckParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; pattern : string; } [@@deriving yojson] end module LocateParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; pattern : string; } [@@deriving yojson] end module PrintParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; pattern : string; } [@@deriving yojson] end module SearchParams = struct type t = { textDocument : VersionedTextDocumentIdentifier.t; position : Position.t; pattern : string; id : string; } [@@deriving yojson] end module DocumentStateParams = struct type t = { textDocument : TextDocumentIdentifier.t; } [@@deriving yojson] end module DocumentStateResult = struct type t = { document : string; } [@@deriving yojson] end type 'a t = | Std : 'a Lsp.Client_request.t -> 'a t | Reset : ResetParams.t -> unit t | About : AboutParams.t -> pp t | Check : CheckParams.t -> pp t | Locate : LocateParams.t -> pp t | Print : PrintParams.t -> pp t | Search : SearchParams.t -> unit t | DocumentState : DocumentStateParams.t -> DocumentStateResult.t t type packed = Pack : 'a t -> packed let t_of_jsonrpc (Jsonrpc.Request.{ method_; params } as req) = let open Lsp.Import.Result.O in match method_ with | "vscoq/resetCoq" -> let+ params = Lsp.Import.Json.message_params params ResetParams.t_of_yojson in Pack (Reset params) | "vscoq/search" -> let+ params = Lsp.Import.Json.message_params params SearchParams.t_of_yojson in Pack (Search params) | "vscoq/about" -> let+ params = Lsp.Import.Json.message_params params AboutParams.t_of_yojson in Pack (About params) | "vscoq/check" -> let+ params = Lsp.Import.Json.message_params params CheckParams.t_of_yojson in Pack (Check params) | "vscoq/locate" -> let+ params = Lsp.Import.Json.message_params params LocateParams.t_of_yojson in Pack (Locate params) | "vscoq/print" -> let+ params = Lsp.Import.Json.message_params params PrintParams.t_of_yojson in Pack (Print params) | "vscoq/documentState" -> let+ params = Lsp.Import.Json.message_params params DocumentStateParams.t_of_yojson in Pack (DocumentState params) | _ -> let+ E req = Lsp.Client_request.of_jsonrpc req in Pack (Std req) let yojson_of_result : type a. a t -> a -> Yojson.Safe.t = fun req resp -> match req with | Reset _ -> yojson_of_unit resp | About _ -> yojson_of_pp resp | Check _ -> yojson_of_pp resp | Locate _ -> yojson_of_pp resp | Print _ -> yojson_of_pp resp | Search _ -> yojson_of_unit resp | DocumentState _ -> DocumentStateResult.(yojson_of_t resp) | Std req -> Lsp.Client_request.yojson_of_result req resp end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>