aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorTörök Edwin <edwintorok@users.noreply.github.com>2022-05-03 00:41:12 +0100
committerGitHub <noreply@github.com>2022-05-02 16:41:12 -0700
commitcc48a46524c7f80b5e203c1aab58826cdb4e5df1 (patch)
tree211c782eae00dec545013bbf5c0cc961026006ee /lua
parentdocs: update README (diff)
downloadnvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar.gz
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar.bz2
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar.lz
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar.xz
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.tar.zst
nvim-lspconfig-cc48a46524c7f80b5e203c1aab58826cdb4e5df1.zip
ocamllsp: add support for the dune filetype (#1884)
* ocamllsp: add dune as supported language 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> * ocamllsp: dune-project and dune-workspace also mark roots 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>
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/ocamllsp.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lua/lspconfig/server_configurations/ocamllsp.lua b/lua/lspconfig/server_configurations/ocamllsp.lua
index 15284716..6cff66b6 100644
--- a/lua/lspconfig/server_configurations/ocamllsp.lua
+++ b/lua/lspconfig/server_configurations/ocamllsp.lua
@@ -6,6 +6,7 @@ local language_id_of = {
ocamlinterface = 'ocaml.interface',
ocamllex = 'ocaml.ocamllex',
reason = 'reason',
+ dune = 'dune'
}
local get_language_id = function(_, ftype)
@@ -15,8 +16,8 @@ end
return {
default_config = {
cmd = { 'ocamllsp' },
- filetypes = { 'ocaml', 'ocaml.menhir', 'ocaml.interface', 'ocaml.ocamllex', 'reason' },
- root_dir = util.root_pattern('*.opam', 'esy.json', 'package.json', '.git'),
+ filetypes = { 'ocaml', 'ocaml.menhir', 'ocaml.interface', 'ocaml.ocamllex', 'reason', 'dune' },
+ root_dir = util.root_pattern('*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace'),
get_language_id = get_language_id,
},
docs = {
@@ -32,7 +33,7 @@ opam install ocaml-lsp-server
```
]],
default_config = {
- root_dir = [[root_pattern("*.opam", "esy.json", "package.json", ".git")]],
+ root_dir = [[root_pattern("*.opam", "esy.json", "package.json", ".git", "dune-project", "dune-workspace")]],
},
},
}