diff options
| author | kylo252 <59826753+kylo252@users.noreply.github.com> | 2021-08-10 17:16:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-10 11:16:02 -0400 |
| commit | 9dca8d65604d5fb76528bcbe09d0a3664959314d (patch) | |
| tree | ec603ba1d5d008b6563cd8ea5584b11be2a6ff40 /lua | |
| parent | [docgen] Update CONFIG.md (diff) | |
| download | nvim-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')
| -rw-r--r-- | lua/lspconfig/dhall_lsp_server.lua | 6 | ||||
| -rw-r--r-- | lua/lspconfig/jsonls.lua | 6 | ||||
| -rw-r--r-- | lua/lspconfig/yamlls.lua | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lua/lspconfig/dhall_lsp_server.lua b/lua/lspconfig/dhall_lsp_server.lua index 761d2b46..29e952c6 100644 --- a/lua/lspconfig/dhall_lsp_server.lua +++ b/lua/lspconfig/dhall_lsp_server.lua @@ -5,7 +5,9 @@ configs.dhall_lsp_server = { default_config = { cmd = { 'dhall-lsp-server' }, filetypes = { 'dhall' }, - 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 = { description = [[ https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server @@ -19,7 +21,7 @@ cabal install dhall-lsp-server prebuilt binaries can be found [here](https://github.com/dhall-lang/dhall-haskell/releases). ]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + root_dir = [[root_pattern(".git") or dirname]], }, }, }, 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]], }, }, } diff --git a/lua/lspconfig/yamlls.lua b/lua/lspconfig/yamlls.lua index 9003a1f6..6bb2d1e4 100644 --- a/lua/lspconfig/yamlls.lua +++ b/lua/lspconfig/yamlls.lua @@ -8,7 +8,9 @@ configs[server_name] = { default_config = { cmd = { bin_name, '--stdio' }, filetypes = { 'yaml' }, - 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 = { package_json = 'https://raw.githubusercontent.com/redhat-developer/vscode-yaml/master/package.json', @@ -21,7 +23,7 @@ yarn global add yaml-language-server ``` ]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + root_dir = [[root_pattern(".git") or dirname]], }, }, } |
