From 9dca8d65604d5fb76528bcbe09d0a3664959314d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 10 Aug 2021 17:16:02 +0200 Subject: fix: don't pass the cwd to root_pattern (#1130) --- lua/lspconfig/jsonls.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lua/lspconfig/jsonls.lua') diff --git a/lua/lspconfig/jsonls.lua b/lua/lspconfig/jsonls.lua index eccfc22f..2e671b84 100644 --- a/lua/lspconfig/jsonls.lua +++ b/lua/lspconfig/jsonls.lua @@ -11,7 +11,9 @@ configs[server_name] = { init_options = { provideFormatter = true, }, - root_dir = util.root_pattern('.git', vim.fn.getcwd()), + root_dir = function(fname) + return util.root_pattern '.git'(fname) or util.path.dirname(fname) + end, }, docs = { -- this language server config is in VSCode built-in package.json @@ -41,7 +43,7 @@ require'lspconfig'.jsonls.setup { ``` ]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + root_dir = [[root_pattern(".git") or dirname]], }, }, } -- cgit v1.2.3-70-g09d2