Superbol_project
module Config : sig ... end
module Diagnostics : sig ... end
module TYPES : sig ... end
include module type of TYPES
with type rootdir = TYPES.rootdir
and type project = TYPES.project
and type rootdir_fallback_policy = TYPES.rootdir_fallback_policy
and type layout = TYPES.layout
type rootdir = TYPES.rootdir
type project = TYPES.project = {
rootdir : rootdir;
config : Superbol_project__.Project_config.TYPES.config;
config_filename : string;
}
type layout = TYPES.layout = {
project_config_filename : string;
Name of the TOML file that is to be found at the root of each project's directory tree.
*)relative_work_dirname : string option;
Relative name of a directory where the LSP should put its working files (caches, etc). No such storage is allowed when None
.
rootdir_fallback_policy : rootdir_fallback_policy;
Policy to determine the root directory of projects based on individual filenames.
*)}
and rootdir_fallback_policy = TYPES.rootdir_fallback_policy =
type t = project
val rootdir_at : dirname:string -> rootdir
rootdir_at ~dirname
initializes a project into an existing directory.
Raises Invalid_argument
in case dirname
is not the name of an existing directory.
rootdir_for ~filename ~layout
locates the project directory for a given file name. This project directory is the closest parent directory of filename
that contains a file with the name layout.project_config_filename
.
When no such file is found, the behavior depends on the given fallback policy: if layout.rootdir_fallback_policy = Same_as_file_directory
, the name of the directory that contains filename
is chosen as root for the project; alternatively, if the fallback is Given_directory dirname
, directory dirname
is used instead.
val for_ :
rootdir:rootdir ->
layout:layout ->
t Cobol_common.Diagnostics.TYPES.with_diags
for_ ~rootdir ~layout
retrieves a project based on its root directory.
This may trigger reading project configuration files if the project was not yet loaded. The name of the project's configuration file is determined by the layout
argument.
with_default_config ~rootdir ~layout
initializes a project structure with a default configuration.
val copybook_lookup_config_for :
filename:string ->
t ->
Cobol_common.Copybook.lookup_config
copybook_lookup_config_for ~uri project
constructs a copybook lookup configuration for a source file with name filename
, in the given project.
val detect_copybook : filename:string -> ?contents:string -> t -> bool
detect_copybook ~filename project
indicates whether a document with the given filename
should be treated as a copybook in project
.
val of_cache :
rootdir:rootdir ->
layout:layout ->
cached ->
t Cobol_common.Diagnostics.TYPES.with_diags
of_cache ~rootdir ~layout cached_project
attempts to load and return a cached project. Behaves like for_ ~rootdir ~layout
in case of error (outdated or missing configuration file).
val config : t -> Superbol_project__.Project_config.TYPES.config
val save_config : ?verbose:bool -> t -> unit
val reload_config :
?verbose:bool ->
t ->
bool Cobol_common.Diagnostics.TYPES.with_diags
reload_config ~verbose project
reloads the configuration of project
from its associated TOML file. Returns true
when the reloaded configuration does not match with the one before the call. Prints some informative message on stderr
if verbose
is set.
module SET : sig ... end
val string_of_rootdir : rootdir -> string
val relative_path_for : filename:string -> t -> string
val absolute_path_for : filename:string -> t -> string