ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Text_document.offset and Text_document.offsets

Open ddickstein opened this issue 2 years ago • 1 comments

We should be able to avoid exposing the zipper in Text_document.Expert by adding the following functions to the non-expert API:

val offset : t -> Position.t -> int
val offsets : t -> Range.t -> int * int
val position : t -> offset:int -> Position.t
val range : t -> start_offset_inclusive:int -> end_offset_exclusive:int -> Range.t

The positions should be interpreted with the text document's encoding.

ddickstein avatar May 08 '23 17:05 ddickstein

(The latter two obviate the recently added advance function)

ddickstein avatar May 08 '23 17:05 ddickstein