aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/jsonls.lua
diff options
context:
space:
mode:
authorkylo252 <59826753+kylo252@users.noreply.github.com>2021-08-10 17:16:02 +0200
committerGitHub <noreply@github.com>2021-08-10 11:16:02 -0400
commit9dca8d65604d5fb76528bcbe09d0a3664959314d (patch)
treeec603ba1d5d008b6563cd8ea5584b11be2a6ff40 /lua/lspconfig/jsonls.lua
parent[docgen] Update CONFIG.md (diff)
downloadnvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar.gz
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar.bz2
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar.lz
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar.xz
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.tar.zst
nvim-lspconfig-9dca8d65604d5fb76528bcbe09d0a3664959314d.zip
fix: don't pass the cwd to root_pattern (#1130)
Diffstat (limited to 'lua/lspconfig/jsonls.lua')
-rw-r--r--lua/lspconfig/jsonls.lua6
1 files changed, 4 insertions, 2 deletions
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]],
},
},
}