zed
zed copied to clipboard
OCaml (+ ReasonML) support
Preliminarily, the TLDR basic request here is syntax and LSP support for OCaml and ReasonML (another syntax for OCaml). I realize that this may need to be a third party extension, but perhaps all of this can provide context on what's required to support it by adding ones own LSP calls (as I think that's on the short term roadmap?).
In VSCode, this is provided by this extension: https://github.com/ocamllabs/vscode-ocaml-platform That extension calls out to this LSP, which I'll describe installation of below: https://github.com/ocaml/ocaml-lsp
The minimum file syntax support would be for .ml, .mli, .re and .rei files which I believe is provided through the LSP. There are more related file types listed here: https://github.com/ocamllabs/vscode-ocaml-platform#features. Not sure if those are included via LSP or separately.
A bit more detail that I hope will be useful:
A bit of a note is that the ocaml toolchain is not typically installed directly but as a package by opam (the primary ocaml package manager, think nvm + npm), or sometimes esy (which also does venv-type sandbox stuff and also ties into actual npm).
Opam uses "switches" (think nvm use 12, but with names so you can many on the same version) which are either global or local. esy uses sandboxes (which can be defined with an esy.json file or inside of package.json iirc). The vscode extension allows you to switch to the sandbox you desire so it can run the appropriate LSP. Whatever solution comes soon for running one's own LSP would need a way to specify which switch to activate before running the lsp, unless starting the lsp is left to the user to do externally. There's also a need to pass flags to the LSP at times in a project, which again would need to be doable if this is controlled within zed.
Hopefully that wasn't more confusing than helpful!
I'm also interested in seeing OCaml support. Can you share any notes on how zed incorporates the various different lsp's? Looking at the python support doc, does zed install pyright if it's not yet installed, or does it also attempt to install it?
To get a simple but workable setup for OCaml development, I think we only need ocamllsp link and ocamlformat link.
VSCode's ocaml platform wraps a handful of other libraries like ocamlformat and sandboxing but it seems unnecessary to have out that out of the box.
I want to see this combination as soon as possible!
tree-sitter: https://github.com/tree-sitter/tree-sitter-ocaml
Since OCaml language support has landed in Zed, let's close this issue out and open a new issue for whatever else didn't make it in from the original request.
Hey, do I need to open another issue for ReasonML?
Tree-sitter is here: https://github.com/reasonml-editor/tree-sitter-reason