Add support for clangd with CUDA (#3598)

* add support for clangd with CUDA
* add clangd with CUDA in supported-tools.md
* add doc for clangd with CUDA
This commit is contained in:
Tommy Chiang 2021-03-21 06:26:53 +08:00 committed by GitHub
parent 4411b4d751
commit 3728d9f76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,23 @@
" Author: Tommy Chiang <ty1208chiang@gmail.com>
" Description: Clangd language server for CUDA (modified from Andrey
" Melentyev's implementation for C++)
call ale#Set('cuda_clangd_executable', 'clangd')
call ale#Set('cuda_clangd_options', '')
call ale#Set('c_build_dir', '')
function! ale_linters#cuda#clangd#GetCommand(buffer) abort
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options'))
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
endfunction
call ale#linter#Define('cuda', {
\ 'name': 'clangd',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')},
\ 'command': function('ale_linters#cuda#clangd#GetCommand'),
\ 'project_root': function('ale#c#FindProjectRoot'),
\})

View File

@ -21,6 +21,24 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options*
This variable can be changed to modify flags given to nvcc.
===============================================================================
clangd *ale-cuda-clangd*
g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable*
*b:ale_cuda_clangd_executable*
Type: |String|
Default: `'clangd'`
This variable can be changed to use a different executable for clangd.
g:ale_cuda_clangd_options *g:ale_cuda_clangd_options*
*b:ale_cuda_clangd_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to clangd.
===============================================================================
clang-format *ale-cuda-clangformat*

View File

@ -109,6 +109,7 @@ Notes:
* Cucumber
* `cucumber`
* CUDA
* `clangd`
* `nvcc`!!
* Cypher
* `cypher-lint`

View File

@ -2688,6 +2688,7 @@ documented in additional help files.
stylelint.............................|ale-css-stylelint|
cuda....................................|ale-cuda-options|
nvcc..................................|ale-cuda-nvcc|
clangd................................|ale-cuda-clangd|
clang-format..........................|ale-cuda-clangformat|
d.......................................|ale-d-options|
dfmt..................................|ale-d-dfmt|

View File

@ -118,6 +118,7 @@ formatting.
* Cucumber
* [cucumber](https://cucumber.io/)
* CUDA
* [clangd](https://clang.llvm.org/extra/clangd.html)
* [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html)
* Cypher
* [cypher-lint](https://github.com/cleishm/libcypher-parser)