this repo has no description
at main 81 lines 2.3 kB view raw
1open Merlin_kernel 2module Location = Ocaml_parsing.Location 3 4type source = string 5 6(** CMIs are provided either statically or as URLs to be downloaded on demand *) 7 8(** Dynamic cmis are loaded from beneath the given url. In addition the 9 top-level modules are specified, and prefixes for other modules. For 10 example, for the OCaml standard library, a user might pass: 11 12 {[ 13 { dcs_url="/static/stdlib"; 14 dcs_toplevel_modules=["Stdlib"]; 15 dcs_file_prefixes=["stdlib__"]; } 16 ]} 17 18 In which case, merlin will expect to be able to download a valid file 19 from the url ["/static/stdlib/stdlib.cmi"] corresponding to the 20 specified toplevel module, and it will also attempt to download any 21 module with the prefix ["Stdlib__"] from the same base url, so for 22 example if an attempt is made to look up the module ["Stdlib__Foo"] 23 then merlin-js will attempt to download a file from the url 24 ["/static/stdlib/stdlib__Foo.cmi"]. 25 *) 26 27type dynamic_cmis = { 28 dcs_url : string; 29 dcs_toplevel_modules : string list; 30 dcs_file_prefixes : string list; 31} 32 33type static_cmi = { 34 sc_name : string; (* capitalised, e.g. 'Stdlib' *) 35 sc_content : string; 36} 37 38type cmis = { 39 static_cmis : static_cmi list; 40 dynamic_cmis : dynamic_cmis option; 41} 42 43type action = 44 | Complete_prefix of source * Msource.position * string option 45 | Type_enclosing of source * Msource.position * string option 46 | All_errors of source * string option 47 | Add_cmis of cmis 48 49type error = { 50 kind : Location.report_kind; 51 loc: Location.t; 52 main : string; 53 sub : string list; 54 source : Location.error_source; 55} 56 57type completions = { 58 from: int; 59 to_: int; 60 entries : Query_protocol.Compl.entry list 61} 62 63type is_tail_position = 64 [`No | `Tail_position | `Tail_call] 65 66(* type errors = { from: int; to_: int; entries: error list } *) 67type answer = 68 | Errors of error list 69 | Completions of completions 70 | Typed_enclosings of 71 (Location.t * [ `Index of int | `String of string ] * is_tail_position) list 72 | Added_cmis 73 74let report_source_to_string = function 75 | Location.Lexer -> "lexer" 76 | Location.Parser -> "parser" 77 | Location.Typer -> "typer" 78 | Location.Warning -> "warning" (* todo incorrect ?*) 79 | Location.Unknown -> "unknown" 80 | Location.Env -> "env" 81 | Location.Config -> "config"