Skip to content

Language server and VS Code extension for Menhir and Ocamllex

Notifications You must be signed in to change notification settings

dalps/menhir-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Menhir LSP

menhir-lsp is a Language Server for the OCaml dialects Menhir and Ocamllex. Its goal is to provide first-class language support for their syntaxes in client editors. A client for VS Code is available through a VS Code extension.

Capabilities

Installation & Usage

Install the server through opam:

opam install menhir-lsp

The server alone doesn't do much, to do its job it needs a client that talks the Language Server Protocol running in your editor. If you use VS Code proceed by installing the Menhir extension, then open a document with the .mly or .mll file extension. The LSP client will launch the server and communicate with it automatically.

For other editors, please refer to their documentation on how to register an LSP client.

Manual installation

Run these commands if you encounter a problem with the opam package or you'd like to hack on the server:

git clone https://github.com/dalps/menhir-lsp.git && cd menhir-lsp
dune install

You can also download a copy of the binary from the lateset release on GitHub. Put it under a folder that's included in your PATH and the client should be able to run it as well.

Development

The server's code lives in the bin directory. It relies on Linol, an OCaml package that simplifies the development of Language Servers, and the visitors OCaml syntax plugin, for automating AST traversals.

It is also based on the original codebases of both Menhir and Ocamllex, whose parsers I modified in order to annotate their ASTs with source locations and make error recovery possible.

Additional references: ocaml-lsp, atd-lsp, catala-lsp. These were huge help material for implementing common LSP tasks in OCaml.

Editor support

Currently only VS Code is supported, but not everyone uses VS Code. If you think this is useful and would like to have menhir-lsp work in your preferred editor, please consider contributing a new client / extension / adapter through a PR. I'm planning to maintain only the VS Code client since that it is my daily editor.

Issues for bugs / missing features are welcome.

License

GNU General Public License v2.0 only

About

Language server and VS Code extension for Menhir and Ocamllex

Resources

Stars

Watchers

Forks

Packages

No packages published