-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCaml (+ ReasonML) support #5316
Comments
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 VSCode's ocaml platform wraps a handful of other libraries like |
I want to see this combination as soon as possible! |
tree-sitter: https://github.com/tree-sitter/tree-sitter-ocaml |
This pull request implements support for the [OCaml Language](https://ocaml.org/). ### Additions - [x] [tree-sitter-ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) grammar - [x] Highlight, Indents, Outline queries - [x] A new file icon for .ml(i) files. Based on [ocaml/ocaml-logo](https://github.com/ocaml/ocaml-logo/blob/master/Colour/SVG/colour-transparent-icon.svg) - [x] LSP Integration with [ocaml-language-server](https://github.com/ocaml/ocaml-lsp) - [x] Completion Labels - [x] Symbol Labels ### Bug Fixes - [x] Improper parsing of LSP headers. ### Missing [will file a separate issue] - Documentation on completionItem, requires: `completionItem/resolve` with support for `documentation` as a provider. ### Screenshots <details><summary>Zed</summary> <img width="1800" alt="Screenshot 2024-02-01 at 03 33 20" src="https://github.com/zed-industries/zed/assets/69181766/e17c184e-203e-40c3-a08f-4de46226b79c"> </details> Release Notes: - Added OCaml Support ([#5316](#5316)). > [!NOTE] > Partially completes #5316 > To complete #5316: > 1. addition of a reason tree-sitter grammar. > 2. opam/esy integration, however it may be better as it's own plugin.
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 |
just wanted to open a issue myself xd |
Go for it @jpx40 |
Do you know if u could add multiple treesitter in one extension maybe i could make a commit for the ocaml one, it's not worth to add a specific reason extension because of the lsp. It's the same as the ocaml one. |
@jpx40 I believe it is, the ocaml extension already has multiple ones |
@Khady yeah, it would be nice to have reasonml as well. |
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 anesy.json
file or inside ofpackage.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!
The text was updated successfully, but these errors were encountered: