···11# merlin-js
2233Try-it: [https://voodoos.github.io/merlin-js](https://voodoos.github.io/merlin-js)
44+55+To run locally, run 'make' then launch an http server from the 'examples' directory. For example:
66+77+```sh
88+make
99+cd examples
1010+python3 -m http.server
1111+```
1212+1313+
+15
example/dynamic.html
···1515 font-family: 'Fira Code', monospace
1616 }
17171818+ p {
1919+ width: 50%;
2020+ margin: auto;
2121+ margin-top: 2rem;
2222+ color: white;
2323+ }
2424+2525+ a {
2626+ color: lightskyblue
2727+ }
2828+1829 #editor {
1930 min-width: 30rem;
2031 width: 50%;
···68796980<body>
7081 <noscript>Sorry, you need to enable JavaScript to see this page.</noscript>
8282+ <p>This example demonstrates merlin with dynamic loading of cmis. Load the
8383+ 'Network' tab of the developer tools to see the requests and responses.
8484+ See also the <a href="index.html">static example</a>.
8585+ </p>
7186 <div id="editor"></div>
7287</body>
7388
+13
example/index.html
···1414 background-color: #4c4956;
1515 font-family: 'Fira Code', monospace
1616 }
1717+1818+ p {
1919+ width: 50%;
2020+ margin: auto;
2121+ margin-top: 2rem;
2222+ color: white;
2323+ }
17242525+ a {
2626+ color: lightskyblue
2727+ }
2828+1829 #editor {
1930 min-width: 30rem;
2031 width: 50%;
···68796980<body>
7081 <noscript>Sorry, you need to enable JavaScript to see this page.</noscript>
8282+ <p>This example demonstrates merlin with all cmis embedded. See <a href="dynamic.html">dynamic.html</a>
8383+ for an example of dynamically loaded cmis.</p>
7184 <div id="editor"></div>
7285</body>
7386
+6
src/extension/merlin_codemirror.mli
···8899module type Config = sig
1010 val worker_url : string
1111+ (** The url of the worker javascript file *)
1212+1113 val cmis : Protocol.cmis
1414+ (** CMIs are required for merlin to work correctly. These can either be
1515+ provided statically or provided as a list of URLs from which the
1616+ CMIs can be downloaded. If using URLs, these will only be
1717+ downloaded on demand. *)
1218end
13191420module Make : functor (Config : Config) -> sig
+3-2
src/protocol/protocol.ml
···3344type source = string
5566+(** CMIs are provided either statically or as URLs to be downloaded on demand *)
67type cmis = {
77- static_cmis : (string * string) list;
88- cmi_urls : string list
88+ static_cmis : (string * string) list; (** name, content pairs *)
99+ cmi_urls : string list (** One URL per cmi, e.g. "/static/stdlib/stdlib__List.cmi" *)
910}
10111112type action =