package coq-lsp
Language Server Protocol native server for Coq
Install
Dune Dependency
Authors
Maintainers
Sources
coq-lsp-0.1.7.8.17.tbz
sha256=efb85d6656abfd26d2c6fd5e69c9b6428b72679d13ee34c493b4253e345b1c8f
sha512=71a47460bab8781bc9f24bae0369b463a9d527a96f1a32eb5752172316f1bdc1941e0430e79d775b61d854a7306ba8f97707c4e406d02bdf8b2ad57877c5e690
doc/src/coq-lsp.coq/utils.ml.html
Source file utils.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
(************************************************************************) (* * 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 2022-2023 Inria -- Dual License LGPL 2.1 / GPL3+ *) (* Written by: Emilio J. Gallego Arias *) (************************************************************************) (* We convert in case of failure to some default values *) let char_of_index ~lines ~line ~byte = if line < Array.length lines then let line = Array.get lines line in match Utf8.char_of_index ~line ~byte with | Some char -> char | None -> Utf8.length line else 0 let to_range ~lines (p : Loc.t) : Lang.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 end_line = line_nb_last - 1 in (* cols *) let start_col = bp - bol_pos in let end_col = ep - bol_pos_last in let start_col = char_of_index ~lines ~line:start_line ~byte:start_col in let end_col = char_of_index ~lines ~line:end_line ~byte:end_col in Lang.Range. { start = { line = start_line; character = start_col; offset = bp } ; end_ = { line = end_line; character = end_col; offset = ep } } let to_orange ~lines = Option.map (to_range ~lines)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>