Skip to content

Commit 37bd4c7

Browse files
committed
feat(graphql): do not use lspconfig.util
1 parent 251d82e commit 37bd4c7

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

lsp/graphql.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@
1010
---
1111
--- Note that you must also have [the graphql package](https://github.com/graphql/graphql-js) installed within your project and create a [GraphQL config file](https://the-guild.dev/graphql/config/docs).
1212

13-
local util = require 'lspconfig.util'
14-
1513
return {
1614
cmd = { 'graphql-lsp', 'server', '-m', 'stream' },
1715
filetypes = { 'graphql', 'typescriptreact', 'javascriptreact' },
1816
root_dir = function(bufnr, on_dir)
19-
local fname = vim.api.nvim_buf_get_name(bufnr)
20-
on_dir(util.root_pattern('.graphqlrc*', '.graphql.config.*', 'graphql.config.*')(fname))
17+
on_dir(vim.fs.root(bufnr, function(name, _)
18+
local patterns = { '.graphqlrc*', '.graphql.config.*', 'graphql.config.*' }
19+
for _, pattern in ipairs(patterns) do
20+
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
21+
return true
22+
end
23+
end
24+
return false
25+
end))
2126
end,
2227
}

0 commit comments

Comments
 (0)