diff options
| author | Alexandru Geană <1569265+abgeana@users.noreply.github.com> | 2022-04-25 23:22:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-25 17:22:43 -0400 |
| commit | 9696d8daf58528edc03dc4472f6b8d4f4f2ab8be (patch) | |
| tree | 6c7fdf8b8fdbf3e49ca0a574a7644e4338c0fe69 /lua | |
| parent | chore: update minimal init.lua to target 0.6.1 (#1858) (diff) | |
| download | nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar.gz nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar.bz2 nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar.lz nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar.xz nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.tar.zst nvim-lspconfig-9696d8daf58528edc03dc4472f6b8d4f4f2ab8be.zip | |
fix(ccls): .git as fallback when detecting project root (#1860)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/ccls.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lua/lspconfig/server_configurations/ccls.lua b/lua/lspconfig/server_configurations/ccls.lua index dd642db2..27c0fd44 100644 --- a/lua/lspconfig/server_configurations/ccls.lua +++ b/lua/lspconfig/server_configurations/ccls.lua @@ -1,10 +1,17 @@ local util = require 'lspconfig.util' +local root_files = { + 'compile_commands.json', + '.ccls', +} + return { default_config = { cmd = { 'ccls' }, filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, - root_dir = util.root_pattern('compile_commands.json', '.ccls', '.git'), + root_dir = function(fname) + return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) + end, offset_encoding = 'utf-32', -- ccls does not support sending a null root directory single_file_support = false, @@ -37,7 +44,9 @@ lspconfig.ccls.setup { ]], default_config = { - root_dir = [[root_pattern("compile_commands.json", ".ccls", ".git")]], + root_dir = function(fname) + return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) + end, }, }, } |
