Module Cobol_lsp.Types

Definitions of module aliases and helper functors

module URIMap : sig ... end
type lsp_config = {
  1. lsp_project_layout : Superbol_project.layout;
    (*

    Describes the layout of projects to be managed by the LSP

    *)
  2. lsp_cache_for : rootdir:string -> Superbol_cache.Cache.t;
    (*

    cache_for looks up a cache based on a given project directory. An application with no file-system at hand passes Superbol_cache.Cache.disabled, which disables caching: every lookup misses and nothing is stored.

    *)
  3. lsp_cache_pruning_policy : Superbol_cache.Types.prune_policy;
    (*

    What a cache is allowed to keep, and/or for how long.

    *)
  4. lsp_cache_verbose : bool;
    (*

    Make the LSP server report some information on its operations on project caches.

    *)
  5. enable_client_configs : bool;
    (*

    Enable requests for configuration settings to the client.

    *)
  6. force_syntax_diagnostics : bool;
    (*

    Force reporting of syntax and pre-processor-related diagnostics (for dialects other that COBOL85, for which they are always enabled).

    *)
}
type params = {
  1. config : lsp_config;
  2. root_uri : Lsp.Types.DocumentUri.t option;
  3. workspace_folders : Lsp.Types.DocumentUri.t list;
  4. with_semantic_tokens : bool;
  5. with_client_config_watcher : bool;
  6. with_client_file_watcher : [ `no | `yes of [ `absolute | `any ] ];
  7. position_encoding : [ `UTF8 | `UTF16 ];
}
type registry = private {
  1. projects : Cobol_lsp__.Lsp_project.SET.t;
  2. docs : Cobol_lsp__.Lsp_document.TYPES.document Stdlib__Map.Make(Lsp.Uri).t;
  3. indirect_diags : Lsp.Types.Diagnostic.t list Stdlib__Map.Make(Lsp.Uri).t Stdlib__Map.Make(Lsp.Uri).t;
  4. pending_tasks : pending_tasks;
  5. sub_state : sub_state;
  6. params : Cobol_lsp__.Lsp_types.params;
}
and sub_state
and pending_tasks
type state =
  1. | NotInitialized of Cobol_lsp__.Lsp_types.lsp_config
  2. | Initialized of Cobol_lsp__.Lsp_types.params
  3. | Running of registry
  4. | ShuttingDown
  5. | Exit of exit_status
and exit_status = (unit, string) Stdlib.result
type 'a error =
  1. | InvalidStatus of state
  2. | UnhandledRequest of 'a Lsp.Client_request.t
  3. | UnknownRequest of string
exception Document_not_found of Lsp.Types.TextDocumentIdentifier.t
type diagnostics = Lsp.Types.Diagnostic.t list Stdlib__Map.Make(Lsp.Uri).t
type element_at_position = {
  1. element_at_position : element_in_context option;
  2. enclosing_compilation_unit_name : string option;
}

Information returned by Lookup.element_at_position.

and element_in_context =
  1. | Data_name of Cobol_ptree.qualname
  2. | Data_full_name of Cobol_ptree.qualname
  3. | Data_item of {
    1. full_qn : Cobol_ptree.qualname option;
    2. item_loc : Cobol_common.Srcloc.TYPES.srcloc;
    }
  4. | Proc_name of {
    1. qn : Cobol_ptree.qualname;
    2. enclosing_section : Cobol_unit.Types.section option;
    }
  5. | Preproc_or_compilation_variable_ref of {
    1. def : Cobol_preproc.Env.var_definition;
    2. use : [ `Substitution | `Evaluation | `Definition ];
    3. loc : Cobol_common.Srcloc.TYPES.srcloc;
    }
type name_definition = {
  1. as_paragraph : paragraph_definition option;
  2. as_item : item_definition option;
}
type copy_operation = string Cobol_common.Srcloc.TYPES.with_loc

with loc of COPY ...

type approx_typing_info =
  1. | Alphanum
  2. | Any
  3. | Boolean
  4. | Condition
  5. | Group
  6. | Index
  7. | Numeric
  8. | NumericEdited
  9. | ObjectRef
  10. | Pointer
type procedure_at_position = {
  1. cu : Cobol_unit.Types.cobol_unit option;
  2. proc_name : Cobol_ptree.qualname option;
}
type document = {
  1. project : Superbol_project__.Project.TYPES.project;
  2. textdoc : Lsp.Text_document.t;
  3. copybook : bool;
  4. artifacts : Cobol_parser.Outputs.artifacts;
  5. semtoks : Superbol_project.Semantic_tokens.t Stdlib.Lazy.t option;
  6. checked : checked_doc option;
  7. rewinder : rewinder option;
  8. recorder : Superbol_cache.Recorder.t option;
  9. parsing_diags : Cobol_parser.Diagnostics.ALL.t;
  10. typecking_diags : Cobol_typeck.Diagnostics.t;
}
and checked_doc = Cobol_typeck.Outputs.t
exception Unparseable of Lsp.Types.DocumentUri.t

Raised by Document.checked.

exception Copybook of Lsp.Types.DocumentUri.t
exception Internal_error of document * exn * Stdlib.Printexc.raw_backtrace

Raised by Document.load and Document.update; allows keeping consistent document contents.

type cached = {
  1. doc_cache_filename : string;
}

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.

include module type of Superbol_project.Config.TYPES
type path =
  1. | RelativeToProjectRoot of string
  2. | RelativeToFileDir of string
type config = {
  1. mutable cobol_config : Cobol_config.t;
  2. mutable dialect_name : string;
    (*

    Builtin GnuCOBOL dialect name, or the name of a configuration file.

    *)
  3. mutable source_format : Cobol_config.source_format_spec;
  4. mutable source_format_by_extension : (string * Cobol_config.source_format_spec) list;
  5. mutable libpath : path list;
  6. mutable libexts : string list;
  7. mutable indent_config : (string * int) list;
  8. mutable exclude_dirs : string list;
    (*

    See excludes_dir.

    *)
  9. mutable mf_comment : bool;
  10. mutable source_encoding : Cobol_common.Text_encoding.t option;
    (*

    Encoding that source files read from disk are decoded with (see Project.decode_source). Not saved in the configuration file: the LSP server sets it according to the settings of its client.

    *)
  11. toml_handle : Ezr_toml.toml_handle;
}
exception ERROR of Superbol_project__.Project_diagnostics.error
include module type of Superbol_project.TYPES
type rootdir
type project = {
  1. rootdir : rootdir;
  2. config : Superbol_project__.Project_config.TYPES.config;
  3. config_filename : string;
}
type layout = {
  1. project_config_filename : string;
    (*

    Name of the TOML file that is to be found at the root of each project's directory tree.

    *)
  2. 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.

    *)
  3. rootdir_fallback_policy : rootdir_fallback_policy;
    (*

    Policy to determine the root directory of projects based on individual filenames.

    *)
}
and rootdir_fallback_policy =
  1. | Same_as_file_directory
  2. | Given_directory of string
type cache_storage_location =
  1. | No_cache_storage
  2. | Store_cache_in_relative_dir of {
    1. relative_dirname : string;
      (*

      Name of cache directory, relative to project root directory.

      *)
    }
  3. | Store_cache_in_shared_dir of {
    1. dirname : string;
    }
type settings_reporter = {
  1. report_dialect_diags : dialect_name:string -> dialect_file:string option -> project -> Cobol_common.Diagnostics.Set.t -> unit;
    (*

    Diagnostics about loading the configuration of dialect dialect_name for a project, from dialect_file if any

    *)
  2. report_config_error : Superbol_project.Diagnostics.error -> unit;
  3. report_invalid_setting : key:string -> string -> unit;
}

How problems met while applying client settings are reported.

type alternate_handler = {
  1. h : 'reply. 'reply Lsp.Client_request.t -> Cobol_lsp__.Lsp_server.TYPES.registry -> ('reply * Cobol_lsp__.Lsp_server.TYPES.registry, 'reply Cobol_lsp__.Lsp_server.TYPES.error) Stdlib.result;
}