Skip to content
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

ocamllsp: add support for the dune filetype #1884

Merged
merged 2 commits into from May 2, 2022

Conversation

edwintorok
Copy link
Contributor

https://github.com/ocaml/ocaml-lsp/blob/master/CHANGES.md#fixes-1 ocaml-lsp-server 1.11.3 supports the dune filetype.
One has to run dune build --watch in order to take advantage of it (and then you get diagnostics about wrong syntax when you save the file, as usual for a language server) : the language server relies on an RPC with the build system for dune file support.

Also improve the dune filetype detection.

cc @undu

ocaml-lsp-server-1.11.3 enables 'dune' rpc integration
(you need a running `dune build --watch` command which provides the RPC
server).
This allows to reformat `dune` files, and to see `dune` and other build
errors as soon as you change a file (e.g. quite useful on newly created
files which would otherwise show an LSP error until first build).

Signed-off-by: Edwin Török <edwin@etorok.net>
Although most dune projects will also have a *.opam file,
this file might be generated by the build system.
Newer versions of dune have a dune-project file to mark the root though,
and users can create a dune-workspace file as well.

Note that `dune` files themselves do NOT mark the root: they can be
present in subdirs too.

The rules on how `dune` itself finds the root are documented here:
https://dune.readthedocs.io/en/stable/usage.html#finding-the-root
"The root of the current workspace is determined by looking up a
dune-workspace or dune-project file in the current directory and its
parent directories. Dune requires at least one of these two files to
operate."

Signed-off-by: Edwin Török <edwin@etorok.net>
@justinmk justinmk merged commit cc48a46 into neovim:master May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants