summaryrefslogtreecommitdiff
path: root/ale_linters/c
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-10-17 17:54:02 +0100
committerw0rp <devw0rp@gmail.com>2019-10-17 17:54:02 +0100
commitdfe9b7cc2650c03127c5f897767bcb85bc0bad1f (patch)
tree5d75384552d4cb982df6322fb6cf59a19ef739f8 /ale_linters/c
parente5a4c82917a17e759350d5137fb1afbf3e933c2a (diff)
parenta1fab5981120a71355924b0d51d6b17423e7319f (diff)
downloadale-dfe9b7cc2650c03127c5f897767bcb85bc0bad1f.zip
Merge remote-tracking branch 'murfalo/clangd-compile-commands'
Diffstat (limited to 'ale_linters/c')
-rw-r--r--ale_linters/c/clangd.vim7
1 files changed, 6 insertions, 1 deletions
diff --git a/ale_linters/c/clangd.vim b/ale_linters/c/clangd.vim
index 0bb38d43..ab8a0259 100644
--- a/ale_linters/c/clangd.vim
+++ b/ale_linters/c/clangd.vim
@@ -3,9 +3,14 @@
call ale#Set('c_clangd_executable', 'clangd')
call ale#Set('c_clangd_options', '')
+call ale#Set('c_build_dir', '')
function! ale_linters#c#clangd#GetCommand(buffer) abort
- return '%e -x c' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
+ let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
+
+ return '%e -x c'
+ \ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
+ \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
endfunction
call ale#linter#Define('c', {