Module INTERNAL.Project_cache

val save : params:Cobol_lsp__.Lsp_types.params -> Cobol_lsp__.Lsp_document.TYPES.document Stdlib__Map.Make(Lsp.Uri).t -> unit

save ~config docs saves the caches of all the given document's projects.

For any project p of which at least one document belongs to docs, any document of p that does not belong to docs is removed from p's cache.

Some notifications about the saving process may be pushed via Lsp_io.send_notification. May raise some IO-related exceptions (Sys_error, Failure).

val load : rootdir:Superbol_project.rootdir -> layout:Superbol_project.layout -> params:Cobol_lsp__.Lsp_types.params -> Superbol_project__.Project.TYPES.project option

load ~rootdir ~config ~layout pre-loads cached documents pertaining to a project located in rootdir, with project directory layout layout.

All projects in the returned map belong to the same project. Note this map may actually be empty (for instance in case of missing, out-dated cache files, or cache files for a different version of the library).

Some notifications about the loading process may be pushed via Lsp_io.send_notification. May raise some IO-related exceptions (Sys_error, Failure).

Saving a single document

val save_document : params:Cobol_lsp__.Lsp_types.params -> Cobol_lsp__.Lsp_document.TYPES.document -> unit

save_document ~params doc persists the cache of doc alone, and records it in the cache of its project so that a later session finds it again. The other documents of that project are left as they are.

Used when a document is saved by the editor: that is when what the file holds and what was parsed are known to agree, which is the condition for a cached document to be of any use.

Some notifications about the saving process may be pushed via Lsp_io.send_notification.

Loading a single document

val load_document : project:Superbol_project__.Project.TYPES.project -> params:Cobol_lsp__.Lsp_types.params -> doc:Lsp.Types.DidOpenTextDocumentParams.t -> Cobol_lsp__.Lsp_document.TYPES.document option

load_document ~project ~params ~doc attempts to restore the document doc that the client has just opened, from the cache of project. Returns None whenever its analysis is missing from the cache, or out-dated.

The analysis may have been stored by another front-end.

Workspace symbols

val workspace_symbols : params:Cobol_lsp__.Lsp_types.params -> except:(string -> bool) -> Superbol_project__.Project.TYPES.project -> (Lsp.Uri.t * Cobol_lsp__.Lsp_workspace_symbols.symbol array) Stdlib.Seq.t

workspace_symbols ~params ~except project retrieves the symbols of the source files of project (see Superbol_project.Walk.source_files) that are held in its cache, along with their URI, except for files whose (absolute) name satisfies except (typically, open documents). Files are never analyzed: those whose symbols are not cached are left out.

Results are memoized per file, until the file changes on disk or project is replaced: changes to copybooks alone go unnoticed until then.

Diagnostics

val cached_diagnostics : params:Cobol_lsp__.Lsp_types.params -> Superbol_project__.Project.TYPES.project -> string list -> (string * Superbol_project.Cached_diagnostics.t option) list

cached_diagnostics ~params project filenames retrieves the diagnostics of each of the (absolute) filenames from the cache of project, as analyzed without overrides. Files are never analyzed: None is given for those whose diagnostics are not cached, or are out-dated.

Encoding of files

val set_file_encoding : Superbol_project__.Project.TYPES.project -> Cobol_common.Text_encoding.t option -> unit

set_file_encoding project encoding records the encoding the client decodes the files of project with (None if it sends them as they are). The files that workspace_symbols and cached_diagnostics read from disk are decoded with it, so that their keys agree with those of the documents the client sends.