Skip to content

Commit 9f21483

Browse files
committed
feat(nimls): do not use lspconfig.util
1 parent 2ab9b9e commit 9f21483

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

lsp/nimls.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
--- nimble install nimlsp
99
--- ```
1010

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

0 commit comments

Comments
 (0)