Wasm32 has a limitation of 4GB / thread. I think that’s more than enough to run neovim + merlin right? (No comment on emacs).
I’m wondering if anyone is working on something where it is possible to run neovim + merlin , both compiled to wasm32, inside a browser.
I am interested in the possibility of an inbrowser-ide, where we fake a filesystem as HashMap<file_name: string, contents: string>, edit this via neovim + plugins, index over this using merlin, then able to compile it (in webworker) by jsoo/parts-of-try-eio.
The end product is something like try-eio, with the following differences:
replace code-mirror + merlin-js w/ [neovim + merlin + plugins]: all compiled to wasm
instead of a single file, fake a fs with Hashmap<file_name: string, contents: string>
===
@patricoferris : If you have time, I’m also curious to hear your thoughts. Is the current try-eio/merlin-js easily extensible to handling multiple files (i.e. HashMap<file_name: string, contents: string>) instead of a single file ?
I don’t think so, the top-level is quite different to compiling programs and it wouldn’t know by itself how to look at the filesystem and load the modules in a correct order iiuc. Furthermore, the top-level is stateful too in that evaluating the files again will happen in the context of the previous evaluations. This could lead to a very confusing experience for users that you might be trying to convince are not using the top-level. I also don’t know the state of OCaml → WASM.
All that being said, I’d like to add that jsoo creates a fake filesystem that all of the file-system-manipulating functions use, so for example you can do the following:
(* Part of Sys_js if you had that in the top-level *)
external create_file : name:string -> content:string -> unit = "caml_create_file"
(* You'll actually only want to run this once, or externally as part of your app *)
let () = create_file ~name:"hello.ml" ~content:{| let msg = "Hello World" |};;
(* Load it in *)
#mod_use "hello.ml";;
let () = print_endline Hello.msg
I don’t think I phrased this question correctly. Let us take a step back, suppose we have, in the browser, the following hashmap
foo.ml:
let foo_bar (x: ...) = ... ;;
let foo_cat (x: ...) (y: ...) = ... ;;
main.ml <-- file code_mirror is editing
Now, CodeMirror is editing main.ml . Suppose we type in let _ = foo_<TAB> at this point, is it possible to get merlin-js to auto complete “foo_bar” and “foo_cat” ?
If so, we can extend the CodeMirror editor into a “multi file editor”.
If not, I’m interested in understanding what merlin-js threw away (since merlin can handle multiple files).
[This is ignoring evaluation for now; just purely concerned with autocompletion, and possibly goto-def.]
I think we’re losing track of the discussion in this thread a little do you want to open the questions as issues on the repos that they relate to? (E.g. Nvim + merlin in wasm? - #7 by zeroexcuses doesn’t have much to do with nvim, merlin or wasm :)) ) – happy to answer and help over there.