Skip to content

Commit 94ef59c

Browse files
committed
feat(ocamllsp): do not use lspconfig.util
1 parent 8ec0e74 commit 94ef59c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lsp/ocamllsp.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
--- opam install ocaml-lsp-server
1010
--- ```
1111

12-
local util = require 'lspconfig.util'
13-
1412
local language_id_of = {
1513
menhir = 'ocaml.menhir',
1614
ocaml = 'ocaml',
@@ -28,8 +26,15 @@ return {
2826
cmd = { 'ocamllsp' },
2927
filetypes = { 'ocaml', 'menhir', 'ocamlinterface', 'ocamllex', 'reason', 'dune' },
3028
root_dir = function(bufnr, on_dir)
31-
local fname = vim.api.nvim_buf_get_name(bufnr)
32-
on_dir(util.root_pattern('*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace')(fname))
29+
on_dir(vim.fs.root(bufnr, function(name, _)
30+
local patterns = { '*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace' }
31+
for _, pattern in ipairs(patterns) do
32+
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
33+
return true
34+
end
35+
end
36+
return false
37+
end))
3338
end,
3439
get_language_id = get_language_id,
3540
}

0 commit comments

Comments
 (0)