Merge pull request #1757 from jtalowell/master
Providing cquery support for C files
This commit is contained in:
commit
79ffdde267
@ -97,7 +97,7 @@ formatting.
|
||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
||||
| Bash | [language-server](https://github.com/mads-hartmann/bash-language-server), shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
||||
|
32
ale_linters/c/cquery.vim
Normal file
32
ale_linters/c/cquery.vim
Normal file
@ -0,0 +1,32 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_cquery_executable', 'cquery')
|
||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#cquery#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#c#cquery#GetInitializationOptions',
|
||||
\})
|
@ -173,6 +173,26 @@ g:ale_c_cppcheck_options *g:ale_c_cppcheck_options*
|
||||
This variable can be changed to modify flags given to cppcheck.
|
||||
|
||||
|
||||
===============================================================================
|
||||
cquery *ale-c-cquery*
|
||||
|
||||
g:ale_c_cquery_executable *g:ale_c_cquery_executable*
|
||||
*b:ale_c_cquery_executable*
|
||||
Type: |String|
|
||||
Default: `'cquery'`
|
||||
|
||||
This variable can be changed to use a different executable for cquery.
|
||||
|
||||
|
||||
g:ale_cpp_cquery_cache_directory *g:ale_c_cquery_cache_directory*
|
||||
*b:ale_c_cquery_cache_directory*
|
||||
Type: |String|
|
||||
Default: `'~/.cache/cquery'`
|
||||
|
||||
This variable can be changed to decide which directory cquery uses for its
|
||||
cache.
|
||||
|
||||
|
||||
===============================================================================
|
||||
flawfinder *ale-c-flawfinder*
|
||||
|
||||
|
@ -30,6 +30,7 @@ CONTENTS *ale-contents*
|
||||
clang-format........................|ale-c-clangformat|
|
||||
clangtidy...........................|ale-c-clangtidy|
|
||||
cppcheck............................|ale-c-cppcheck|
|
||||
cquery..............................|ale-c-cquery|
|
||||
flawfinder..........................|ale-c-flawfinder|
|
||||
gcc.................................|ale-c-gcc|
|
||||
chef..................................|ale-chef-options|
|
||||
@ -336,7 +337,7 @@ Notes:
|
||||
* Awk: `gawk`
|
||||
* Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt`
|
||||
* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt`
|
||||
* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `flawfinder`, `gcc`
|
||||
* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`
|
||||
* C++ (filetype cpp): `clang`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`
|
||||
* CUDA: `nvcc`!!
|
||||
* C#: `mcs`, `mcsc`!!
|
||||
|
Loading…
Reference in New Issue
Block a user