Module Dm.DocumentManagerSource

The document manager holds the view that Rocq 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.

Sourcetype blocking_error = {
  1. last_range : Protocol.LspWrapper.Range.t;
  2. error_range : Protocol.LspWrapper.Range.t;
}
Sourcetype state
Sourcetype event
Sourceval pp_event : Format.formatter -> event -> unit
Sourcetype events = event Sel.Event.t list
Sourceval is_parsing : state -> bool

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

Sourceval apply_text_edits : state -> Types.text_edit list -> state * events

apply_text_edits doc edits updates the text of doc with edits. A ParseEvent is triggered, once processed: the new document is parsed, outdated executions states are invalidated, and the observe id is updated.

Sourceval 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

Sourceval interpret_to_position : Protocol.LspWrapper.Position.t -> events

interpret_to_position pos navigates to the last sentence ending before or at pos and returns the resulting state, events that need to take place, and a possible blocking error.

Sourceval interpret_to_previous : unit -> events

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

Sourceval interpret_to_next : unit -> events

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

Sourceval interpret_to_end : unit -> events

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

Sourceval interpret_in_background : state -> state * events

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

Sourceval reset : state -> state * events

resets Rocq

Sourceval executed_ranges : state -> Types.exec_overview

executes_ranges doc returns the ranges corresponding to the sentences that have been executed. settings.check_mode allows to send a "cut" range that only goes until the observe_id in the case of manual mode

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

returns the range of the sentence referenced by observe_id *

returns the messages associated to a given position

returns the Feedback.Info level messages associated to a given position

Sourceval get_document_symbols : state -> Lsp.Types.DocumentSymbol.t list
Sourceval get_document_proofs : state -> Protocol.ProofState.proof_block list
Sourceval all_diagnostics : state -> Lsp.Types.Diagnostic.t list

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

Sourceval get_proof : state -> Types.sentence_id option -> Protocol.ProofState.t option
Sourceval handle_event : event -> state -> (state, event) Types.handled_event

handles events and returns a new state if it was updated. On top of the next events, it also returns info on whether execution has halted due to an error and returns a boolean flag stating whether the view should be updated

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

Sourceval jump_to_definition : state -> Protocol.LspWrapper.Position.t -> (Protocol.LspWrapper.Range.t * string) option
Sourcemodule Internal : sig ... end