Add OCaml support (#6929)

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](https://github.com/zed-industries/zed/issues/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.
This commit is contained in:
Rashid Almheiri
2024-02-02 16:58:07 +02:00
committed by GitHub
parent 980d4f1003
commit 998f6cf80d
19 changed files with 784 additions and 9 deletions
+31
View File
@@ -0,0 +1,31 @@
# OCaml
- Tree Sitter: [tree-sitter-ocaml](https://github.com/tree-sitter/tree-sitter-ocaml)
- Language Server: [ocamllsp](https://github.com/ocaml/ocaml-lsp)
## Setup Instructions
If you have the development environment already setup, you can skip to [Launching Zed](#launching-zed)
### Using OPAM
Opam is the official package manager for OCaml and is highly recommended for getting started with OCaml. To get started using Opam, please follow the instructions provided [here](https://opam.ocaml.org/doc/Install.html).
Once you install opam and setup a switch with your development environment as per the instructions, you can proceed.
### Launching Zed
By now you should have `ocamllsp` installed, you can verify so by running
```sh
$ ocamllsp --help
```
in your terminal. If you get a help message, you're good to go. If not, please revisit the installation instructions for `ocamllsp` and ensure it's properly installed.
With that aside, we can now launch Zed. Given how the OCaml package manager works, we require you to run Zed from the terminal, so please make sure you install the [Zed cli](https://zed.dev/features#cli) if you haven't already.
Once you have the cli, simply from a terminal, navigate to your project and run
```sh
$ zed .
```
Voila! You should have Zed running with OCaml support, no additional setup required.