diff options
author | Gagbo <Gagbo@users.noreply.github.com> | 2017-06-24 13:38:16 +0200 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-06-24 12:38:16 +0100 |
commit | e98560a349f3381c8fc6ecb6bf149c337dcf17be (patch) | |
tree | 7ad98b85b261aa3e085df5e7aaa558687c35955d /autoload | |
parent | 026c4f304ee69b81c80f9969c62353546c847c7a (diff) | |
download | ale-e98560a349f3381c8fc6ecb6bf149c337dcf17be.zip |
Added builddir option to clang-tidy to point to json folder (#688)
Detect compille_commands.json files for clang-tidy
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/c.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/ale/c.vim b/autoload/ale/c.vim new file mode 100644 index 00000000..9cc2521e --- /dev/null +++ b/autoload/ale/c.vim @@ -0,0 +1,24 @@ +" Author: gagbo <gagbobada@gmail.com> +" Description: Functions for integrating with C-family linters. + + +let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ +\ 'build', +\ 'bin', +\]) + +" Given a buffer number, find the build subdirectory with compile commands +" The subdirectory is returned without the trailing / +function! ale#c#FindCompileCommands(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:dirname in ale#Var(a:buffer, 'c_build_dir_names') + let l:c_build_dir = l:path . '/' . l:dirname + + if filereadable(l:c_build_dir . '/compile_commands.json') + return l:c_build_dir + endif + endfor + endfor + + return '' +endfunction |