22
33[ ![ Build] ( https://github.com/ocaml/ocaml-lsp/workflows/Build%20and%20Test/badge.svg )] ( https://github.com/ocaml/ocaml-lsp/actions )
44
5- This project contains an implementation of an LSP server for OCaml and a
6- standalone implementation of the LSP protocol.
5+ OCaml-LSP is a language server for OCaml that implements [ Language Server Protocol] ( https://microsoft.github.io/language-server-protocol/ ) (LSP).
6+
7+ This project contains an implementation of a language server for OCaml and a standalone
8+ library implementing LSP.
79
810## Installation
911
10- We recommend to install the server via a project such as
12+ We recommend to install the language server via a package manager such as
1113[ opam] ( http://github.com/ocaml/opam ) or [ esy] ( https://github.com/esy/esy ) .
1214
1315### Opam
1416
15- To install the lsp server in a particular opam switch:
17+ To install the language server in the currently used opam [ switch] ( https://opam.ocaml.org/doc/Manual.html#Switches ) :
1618
17- ```
19+ ``` sh
1820$ opam install ocaml-lsp-server
1921```
2022
21- Note that you will need to run install the lsp server in every switch where
22- you'd like to use it.
23+ * Note: * you will need to install ` ocaml- lsp- server` in every switch where you would like
24+ to use it.
2325
2426### Esy
2527
26- To add the lsp server to an esy project:
28+ To add the language server to an esy project, run in terminal :
2729
2830```
2931$ esy add @opam/ocaml-lsp-server
@@ -32,10 +34,10 @@ $ esy add @opam/ocaml-lsp-server
3234### Source
3335
3436This project uses submodules to handle dependencies. This is done so that users
35- who install ocaml-lsp-server into their sandbox will not share constraints on
36- the same dependencies that ocaml-lsp-server is using.
37+ who install ` ocaml-lsp-server ` into their sandbox will not share dependency constraints on
38+ the same packages that ` ocaml-lsp-server ` is using.
3739
38- ```
40+ ``` sh
3941$ git clone --recurse-submodules http://github.com/ocaml/ocaml-lsp.git
4042$ cd ocaml-lsp
4143$ make build
@@ -44,21 +46,21 @@ $ make build
4446## Usage
4547
4648Once ` ocaml-lsp-server ` is installed, the executable is called ` ocamllsp ` . For
47- now, the server can only be used through the standard file descriptors ` stdin `
48- and ` stdout ` .
49+ now, the server can only be used through the standard input ( ` stdin ` ) and output
50+ ( ` stdout ` ) file descriptors .
4951
50- For an example of usage of the server in a VSCode extension, see
51- [ here] ( https://github.com/ocamllabs/vscode-ocaml-platform/blob/master/src/vscode_ocaml_platform.ml ) .
52+ For an example of usage of the server in a VS Code extension, see
53+ OCaml Platform Extension implementation [ here] ( https://github.com/ocamllabs/vscode-ocaml-platform/blob/master/src/vscode_ocaml_platform.ml ) .
5254
5355## Features
5456
55- The server supports the following queries :
57+ The server supports the following LSP requests :
5658
5759- [x] ` textDocument/completion `
5860- [x] ` completionItem/resolve `
5961- [x] ` textdocument/hover `
6062- [ ] ` textDocument/signatureHelp `
61- - [ ] ` textDocument/declaration `
63+ - [x ] ` textDocument/declaration `
6264- [x] ` textDocument/definition `
6365- [x] ` textDocument/typeDefinition `
6466- [ ] ` textDocument/implementation `
@@ -78,7 +80,17 @@ The server supports the following queries:
7880
7981Note that degrees of support for each LSP request are varying.
8082
81- ## Contribution
83+ ## Integration with other tools
84+
85+ ### Formatters: OCamlFormat & Refmt
86+
87+ OCaml-LSP is dependent on external tools (OCamlFormat for OCaml and ` refmt ` for Reason)
88+ for formatting source files. You should have the necessary tool (OCamlFormat and/or Refmt)
89+ installed in your opam switch or esy project to have formatting support. Note, however, that
90+ OCaml-LSP requires presence of OCamlFormat configuration file (called ` .ocamlformat ` ) in
91+ the project root to be able to format source files in your project.
92+
93+ ## Contributing to project
8294
8395``` bash
8496# clone repo with submodules
@@ -104,7 +116,7 @@ make lsp-server
104116
105117To run tests execute:
106118
107- ```
119+ ``` sh
108120$ make test
109121```
110122
0 commit comments