package coq-lsp

  1. Overview
  2. Docs
Language Server Protocol native server for Coq

Install

Dune Dependency

Authors

Maintainers

Sources

coq-lsp-0.1.1.v8.16.tbz
sha256=be48fd1449d8a0eb209e83ebbcde95090e94ba74ee7e744a399c3a5b67cc4acb
sha512=c711b953346d3e45ed61c75d5f3825d877820dec38e5dc803cd1ab9a32d6b4a850232a84984c3c340d3939c459ea0595f606d303e1ba714e4245a784b3507ab0

doc/src/coq-lsp.fleche/types.ml.html

Source file types.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
(************************************************************************)
(*         *   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 -- Dual License LGPL 2.1 / GPL3+      *)
(* Copyright 2019-2022 Inria      -- Dual License LGPL 2.1 / GPL3+      *)
(* Written by: Emilio J. Gallego Arias                                  *)
(************************************************************************)

(* XXX: ejgallego, do we start lines at 0? *)
module Point = struct
  type t =
    { line : int
    ; character : int
    ; offset : int
    }
end

module Range = struct
  type t =
    { start : Point.t
    ; end_ : Point.t
    }
end

module Diagnostic = struct
  module Extra = struct
    type t =
      | FailedRequire of
          { prefix : Libnames.qualid option
          ; refs : Libnames.qualid list
          }
  end

  type t =
    { range : Range.t
    ; severity : int
    ; message : string
    ; extra : Extra.t list
    }
end

let to_range (p : Loc.t) : Range.t =
  let Loc.{ line_nb; line_nb_last; bol_pos; bol_pos_last; bp; ep; _ } = p in
  let start_line = line_nb - 1 in
  let start_col = bp - bol_pos in
  let end_line = line_nb_last - 1 in
  let end_col = ep - bol_pos_last in
  Range.
    { start = { line = start_line; character = start_col; offset = bp }
    ; end_ = { line = end_line; character = end_col; offset = ep }
    }

let to_orange = Option.map to_range
OCaml

Innovation. Community. Security.