Cobol_lsp.Documentmodule DIAGS = Cobol_common.Diagnosticsmodule ANALYSIS = Superbol_project.Analysismodule TYPES : sig ... endinclude module type of struct include TYPES endtype document = TYPES.document = {project : Superbol_project__.Project.TYPES.project;textdoc : Lsp.Text_document.t;copybook : bool;artifacts : Cobol_parser.Outputs.artifacts;semtoks : Superbol_project.Semantic_tokens.t Stdlib.Lazy.t option;checked : checked_doc option;rewinder : rewinder option;recorder : Superbol_cache.Recorder.t option;parsing_diags : Cobol_parser.Diagnostics.ALL.t;typecking_diags : Cobol_typeck.Diagnostics.t;}and checked_doc = Cobol_typeck.Outputs.tand rewinder =
(Cobol_ptree.compilation_group, Cobol_common.Behaviors.eidetic)
Cobol_parser.rewinderRaised by Document.checked.
exception Internal_error of document * exn * Stdlib.Printexc.raw_backtraceRaised by Document.load and Document.update; allows keeping consistent document contents.
Persistent representation of LSP-specific data (for caching). The analysis results are cached separately, as a Superbol_project.Analysis.for_lsp, so that they can be shared with other front-ends.
type t = documentval uri : document -> Lsp__.Uri0.tval language_id : document -> stringval analysis_overrides : language_id:string -> ANALYSIS.overridesanalysis_overrides ~language_id are the departures from their project's configuration with which documents with the given language identifier are to be analyzed.
val analysis_overrides_for : document -> ANALYSIS.overridesval preproc_options :
platform:Cobol_common.Platform.TYPES.platform ->
document ->
Cobol_preproc.Options.preproc_optionsval rewindable_parse :
platform:Cobol_common.Platform.TYPES.platform ->
document ->
((Cobol_ptree.compilation_group option, Cobol_common.Behaviors.eidetic)
Cobol_parser__.Parser_outputs.output
* (Cobol_ptree.compilation_group, Cobol_common.Behaviors.eidetic)
Cobol_parser.rewinder)
Cobol_common__Diagnostics_accumulator.MAKE(Cobol_parser__.Parser_diagnostics.ALL).TYPES.with_diagsval no_artifacts : Cobol_parser.Outputs.artifactsval reparse_and_analyze :
?position:Cobol_parser.position ->
document ->
documentval inspect_at :
position:Lsp.Types.Position.t ->
f:(Cobol_parser.inspectable_parser_state -> 'a) ->
document ->
'a optioninspect_at ~position ~f doc passes to f the state that is reached by the parser at position in doc. Returns None on copybooks, or Some r for r the result of f.
val blank :
project:Superbol_project__.Project.TYPES.project ->
Lsp.Text_document.t ->
documentCreates a record for a document that is not yet parsed or analyzed.
val load :
project:Superbol_project__.Project.TYPES.project ->
params:Cobol_lsp__.Lsp_types.params ->
Lsp__.Types.DidOpenTextDocumentParams.t ->
documentval unload : document -> unitval first_change_pos :
Lsp.Types.TextDocumentContentChangeEvent.t list ->
Cobol_parser.positionval checked : document -> checked_docRaises Unparseable in case the document cannot be parsed entierely, or Copybook in case the document is not a main program.
val diagnostics : document -> DIAGS.Set.tCaching utilities
val to_cache :
with_semantic_tokens:bool ->
document ->
ANALYSIS.for_lsp
* Superbol_project.Semantic_tokens.t option
* Superbol_cache.Types.witness list option
* cachedto_cache ~with_semantic_tokens doc splits doc into its analysis results, its semantic tokens, the witnesses these were obtained against, and LSP-specific data. The witnesses are None on a document whose analysis was restored from cache rather than performed: there is then nothing to store it against, and the entries it was restored from are there already anyway.
Semantic tokens are only given if with_semantic_tokens holds (the client is then bound to ask for them anyway), and the witnesses are not None.
val of_cache :
project:Superbol_project__.Project.TYPES.project ->
params:Cobol_lsp__.Lsp_types.params ->
doc:Lsp__.Types.DidOpenTextDocumentParams.t ->
?semtoks:Superbol_project.Semantic_tokens.t ->
ANALYSIS.for_lsp ->
cached option ->
documentof_cache ~project ~params ~doc ?semtoks analysis cached rebuilds a document from the client's doc, its cached analysis analysis, and its cached semantic tokens semtoks, if any.
The caller has already established that the contents of doc are what analysis was recorded against: the contents take part in the key the entry is stored under. Everything else the analysis depended upon is checked by the cache, against the witnesses it was stored with.