package vscoq-language-server

  1. Overview
  2. Docs

The document manager holds the view that Coq has of the currently open states. It makes it easy for IDEs to handle text edits, navigate and get feedback. Note that it does not require IDEs to parse vernacular sentences.

type observe_id =
  1. | Id of Types.sentence_id
  2. | Top
type state
type event
val pp_event : Stdlib.Format.formatter -> event -> unit
type events = event Sel.Event.t list
val init : Vernacstate.t -> opts:Coqargs.injection_command list -> Lsp.Types.DocumentUri.t -> text:string -> observe_id option -> state * events

init st opts uri text initializes the document manager with initial vernac state st on which command line opts will be set.

val apply_text_edits : state -> Types.text_edit list -> state

apply_text_edits doc edits updates the text of doc with edits. The new document is parsed, outdated executions states are invalidated, and the observe id is updated.

val clear_observe_id : state -> state

clear_observe_id state updates the state to make the observe_id None

val reset_to_top : state -> state

reset_to_top state updates the state to make the observe_id Top

get_next_range st pos get the range of the next sentence relative to pos

get_previous_pos st pos get the range of the previous sentence relative to pos

val interpret_to_position : state -> Protocol.LspWrapper.Position.t -> state * events

interpret_to_position stateful doc pos navigates to the last sentence ending before or at pos and returns the resulting state. The stateful flag determines if we record the resulting position in the state.

val interpret_to_previous : state -> state * events

interpret_to_previous doc navigates to the previous sentence in doc and returns the resulting state.

val interpret_to_next : state -> state * events

interpret_to_next doc navigates to the next sentence in doc and returns the resulting state.

val interpret_to_end : state -> state * events

interpret_to_end doc navigates to the last sentence in doc and returns the resulting state.

val interpret_in_background : state -> state * events

interpret_in_background doc same as interpret_to_end but computation is done in background (with lower priority)

val reset : state -> state * events

resets Coq

val executed_ranges : state -> Types.exec_overview

returns the ranges corresponding to the sentences that have been executed and remotely executes

val observe_id_range : state -> Protocol.LspWrapper.Range.t option

returns the range of the sentence referenced by observe_id *

val all_diagnostics : state -> Lsp.Types.Diagnostic.t list

all_diagnostics doc returns the diagnostics corresponding to the sentences that have been executed in doc.

val get_completions : state -> Protocol.LspWrapper.Position.t -> (CompletionItems.completion_item list, string) Stdlib.Result.t
val handle_event : event -> state -> state option * events

handles events and returns a new state if it was updated

val about : state -> Protocol.LspWrapper.Position.t -> pattern:string -> (Protocol.Printing.pp, string) Stdlib.Result.t
val hover : state -> Protocol.LspWrapper.Position.t -> Lsp.Types.MarkupContent.t option

Returns an optional Result: if None, the position did not have a word, if Some, an Ok/Error result is returned.

val check : state -> Protocol.LspWrapper.Position.t -> pattern:string -> (Protocol.Printing.pp, string) Stdlib.Result.t
val locate : state -> Protocol.LspWrapper.Position.t -> pattern:string -> (Protocol.Printing.pp, string) Stdlib.Result.t
val print : state -> Protocol.LspWrapper.Position.t -> pattern:string -> (Protocol.Printing.pp, string) Stdlib.Result.t
module Internal : sig ... end
OCaml

Innovation. Community. Security.