ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Support for running from a web worker

Open ejgallego opened this issue 3 years ago • 2 comments

Dear ocaml-lsp devs,

I am interested in running ocaml-lsp from a web-worker ; would support for that be welcomed?

ejgallego avatar Sep 09 '22 15:09 ejgallego

Hi,

First, I wonder where such desire comes from. (If you'd like it to run in a web-worker to use with vscode.dev, then I would start with making the extension available on the web first. There's been some prior work: https://github.com/ocamllabs/vscode-ocaml-platform/pull/962)

Second, olsp depends on file system and spawning processes system features, how'd you like to address those needs in the context of a web worker? (I know @voodoos did some work on making merlin web-compatible; I have no idea how that works though, given it needs to read cmi's from the fs (?))

ulugbekna avatar Sep 11 '22 11:09 ulugbekna

Hi Emilio ! I indeed have a prototype of Merlin working in the browser ! It is actually already enabled in the official playground: https://ocaml.org/play I use a web worker that runs a version of Merlin built with js_of_ocaml and a set of plugins written for the Code Mirror editor. CMIs for the stdlib are embedded in the javascript code and loaded via js_of_ocaml pseudo file system.

It is still a bit rough around the edges but quite satisfying to use already :-)

I would be happy to help you using it !

voodoos avatar Sep 11 '22 12:09 voodoos