Skip to content

Commit eadf6ae

Browse files
committed
feat(regols): do not use lspconfig.util
1 parent b3dc67c commit eadf6ae

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lsp/regols.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99
--- go install github.com/kitagry/regols@latest
1010
--- ```
1111

12-
local util = require 'lspconfig.util'
13-
1412
return {
1513
cmd = { 'regols' },
1614
filetypes = { 'rego' },
1715
root_dir = function(bufnr, on_dir)
18-
local fname = vim.api.nvim_buf_get_name(bufnr)
19-
on_dir(util.root_pattern '*.rego'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]))
16+
on_dir(vim.fs.root(bufnr, function(name, _)
17+
local patterns = { '*.rego', '.git' }
18+
for _, pattern in ipairs(patterns) do
19+
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
20+
return true
21+
end
22+
end
23+
return false
24+
end))
2025
end,
2126
}

0 commit comments

Comments
 (0)