INTERNAL.Project
module TYPES : sig ... end
include module type of TYPES
with type path = TYPES.path
and type rootdir = TYPES.rootdir
and type project = TYPES.project
and type layout = TYPES.layout
include module type of Superbol_project.Config.TYPES
with type path = TYPES.path
type config = {
mutable cobol_config : Cobol_config.t;
mutable source_format : Cobol_config.source_format_spec;
mutable libpath : path list;
mutable libexts : string list;
mutable indent_config : (string * int) list;
toml_handle : Ezr_toml.toml_handle;
}
include module type of Superbol_project.TYPES
with type rootdir = TYPES.rootdir
with type project = TYPES.project
with 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.
*)}
type t = project
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.
May puplish notifications about the loading process directly via Lsp_io.send_diagnostics
or Lsp_io.send_notification
, and send diagnostics about loaded configuration files via Lsp_diagnostics.publish
.
in_existing_dir dirname ~layout
retrieves a project after checking dirname
actually refers to an exising directory that can serve as root for the project.
The same notes as for for_
apply, with the addition that Invalid_argument
is raised in case dirname
is not the name of an existing directory.
rootdir_for ~uri ~layout
locates the project directory (that contains a file with given name layout.project_config_filename
) for a file at the given URI. The behavior when no such file is found is that of Superbol_project.rootdir_for
.
val copybook_lookup_config_for :
uri:Lsp.Uri.t ->
t ->
Cobol_common.Copybook.lookup_config
copybook_lookup_config_for ~uri project
constructs a copybook lookup configuration for a source file at the given URI, in the given project.
val detect_copybook : uri:Lsp.Uri.t -> ?contents:string -> t -> bool
detect_copybook ~uri ?contents project
indicates whether a document at the given URI for project
should be treated as a copybook.
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).
module SET : sig ... end
Warning: functions below that return a Boolean actually perform some mutations on project's configurations. They return true
if the configuration of the given project has changed.
val reload_project_config : t -> bool
val update_project_config : (string * Yojson.Safe.t) list -> t -> bool
val get_project_config : ?flat:bool -> t -> Yojson.Safe.t
val rooturi : t -> Lsp.Uri.t
val config : t -> Superbol_project.Config.t
val string_of_rootdir : rootdir -> string
val relative_path_for : uri:Lsp.Uri.t -> t -> string
val absolute_path_for : filename:string -> t -> string