package vscoq-language-server

  1. Overview
  2. Docs

Module Dm.DocumentSource

This file defines operations on the content of a document (text, parsing of sentences, scheduling).

Sourcetype document

The document gathers the text, which is partially validated (parsed into sentences

Sourcetype proof_block_type =
  1. | TheoremKind of Decls.theorem_kind
  2. | DefinitionType of Decls.definition_object_kind
  3. | Other
Sourcetype outline_element = {
  1. id : Types.sentence_id;
  2. name : string;
  3. type_ : proof_block_type;
  4. statement : string;
  5. range : Lsp.Types.Range.t;
}
Sourcetype outline = outline_element list
Sourceval raw_document : document -> RawDocument.t
Sourceval outline : document -> outline
Sourceval create_document : Vernacstate.Synterp.t -> string -> document

create_document init_synterp_state text creates a fresh document with content defined by text under init_synterp_state.

Sourceval validate_document : document -> Types.sentence_id option * Types.sentence_id_set * document

validate_document doc parses the document without forcing any execution and returns the id of the bottommost sentence of the prefix which has not changed since the previous validation, as well as the set of invalidated sentences

Sourcetype parsed_ast = {
  1. ast : Synterp.vernac_control_entry;
  2. classification : Vernacextend.vernac_classification;
  3. tokens : Tok.t list;
}
Sourcetype parsing_error = {
  1. start : int;
  2. stop : int;
  3. msg : string Loc.located;
  4. qf : Types.Quickfix.t list option;
}
Sourceval parse_errors : document -> parsing_error list

parse_errors doc returns the list of sentences which failed to parse (see validate_document) together with their error message

Sourceval apply_text_edit : document -> Types.text_edit -> document

parse_errors doc returns the list of sentences which failed to parse (see validate_document) together with their error message

apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.

Sourceval apply_text_edits : document -> Types.text_edit list -> document

apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.

apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.

Sourcetype sentence = {
  1. parsing_start : int;
  2. start : int;
  3. stop : int;
  4. synterp_state : Vernacstate.Synterp.t;
  5. scheduler_state_before : Scheduler.state;
  6. scheduler_state_after : Scheduler.state;
  7. ast : parsed_ast;
  8. id : Types.sentence_id;
}
Sourcetype comment = {
  1. start : int;
  2. stop : int;
  3. content : string;
}
Sourcetype code_line =
  1. | Sentence of sentence
  2. | ParsingError of parsing_error
  3. | Comment of comment
Sourceval sentences : document -> sentence list
Sourceval code_lines_sorted_by_loc : document -> code_line list
Sourceval code_lines_by_end_sorted_by_loc : document -> code_line list
Sourceval sentences_sorted_by_loc : document -> sentence list
Sourceval get_sentence : document -> Types.sentence_id -> sentence option
Sourceval sentences_before : document -> int -> sentence list
Sourceval find_sentence : document -> int -> sentence option

find_sentence pos loc finds the sentence containing the loc

Sourceval find_sentence_before : document -> int -> sentence option

find_sentence_before pos loc finds the last sentence before the loc

Sourceval find_sentence_after : document -> int -> sentence option

find_sentence_after pos loc finds the first sentence after the loc

Sourceval find_next_qed : document -> int -> sentence option

find_next_qed parsed loc finds the next proof end

Sourceval get_first_sentence : document -> sentence option

get_first_sentence doc returns the first parsed sentence

Sourceval get_last_sentence : document -> sentence option

get_last_sentence doc returns the last parsed sentence

Sourceval range_of_id : document -> Stateid.t -> Lsp.Types.Range.t

range_of_id doc id returns a Range object coressponding to the sentence id given in argument

Sourceval range_of_id_with_blank_space : document -> Stateid.t -> Lsp.Types.Range.t

range_of_id_with_blank_space doc id returns a Range object coressponding to the sentence id given in argument but with the white spaces before (until the previous sentence)

Sourcemodule Internal : sig ... end
OCaml

Innovation. Community. Security.