summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/clangd.vim
diff options
context:
space:
mode:
authorMurfalo <howdy@murfalo.com>2019-10-03 13:17:17 -0400
committerMurfalo <howdy@murfalo.com>2019-10-03 13:22:13 -0400
commit618f2d71fcfb13b99f221de6c47120c572a912d8 (patch)
treef07000142056dea242fb2e20405c90fda7a627ee /ale_linters/cpp/clangd.vim
parent41ff80dc9ec2cc834cc8c4aaa753e308223d48b8 (diff)
downloadale-618f2d71fcfb13b99f221de6c47120c572a912d8.zip
Added automatic compile-commands-dir arg to ale_cpp_clangd linter
Diffstat (limited to 'ale_linters/cpp/clangd.vim')
-rw-r--r--ale_linters/cpp/clangd.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/ale_linters/cpp/clangd.vim b/ale_linters/cpp/clangd.vim
index fab605f4..8b7f0284 100644
--- a/ale_linters/cpp/clangd.vim
+++ b/ale_linters/cpp/clangd.vim
@@ -5,7 +5,11 @@ call ale#Set('cpp_clangd_executable', 'clangd')
call ale#Set('cpp_clangd_options', '')
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
- return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
+ let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
+
+ return '%e'
+ \ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
+ \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
endfunction
call ale#linter#Define('cpp', {