diff options
author | Tommy Chiang <oToToT@users.noreply.github.com> | 2021-03-21 06:26:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-20 22:26:53 +0000 |
commit | 3728d9f76c235909c22a45c54d9984183f42b131 (patch) | |
tree | e8262ab7b1fe7835ec41eeb335d542e1c89f6e7e | |
parent | 4411b4d751f944892c7d5c17a503a9a55fd9ddd1 (diff) | |
download | ale-3728d9f76c235909c22a45c54d9984183f42b131.zip |
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
-rw-r--r-- | ale_linters/cuda/clangd.vim | 23 | ||||
-rw-r--r-- | doc/ale-cuda.txt | 18 | ||||
-rw-r--r-- | doc/ale-supported-languages-and-tools.txt | 1 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | supported-tools.md | 1 |
5 files changed, 44 insertions, 0 deletions
diff --git a/ale_linters/cuda/clangd.vim b/ale_linters/cuda/clangd.vim new file mode 100644 index 00000000..bfda821b --- /dev/null +++ b/ale_linters/cuda/clangd.vim @@ -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'), +\}) diff --git a/doc/ale-cuda.txt b/doc/ale-cuda.txt index 0e53f756..06aa48ce 100644 --- a/doc/ale-cuda.txt +++ b/doc/ale-cuda.txt @@ -22,6 +22,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* See |ale-c-clangformat| for information about the available options. diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index fde158fe..a2d14ef2 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -109,6 +109,7 @@ Notes: * Cucumber * `cucumber` * CUDA + * `clangd` * `nvcc`!! * Cypher * `cypher-lint` diff --git a/doc/ale.txt b/doc/ale.txt index cb11226d..796dd428 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -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| diff --git a/supported-tools.md b/supported-tools.md index 1bcbe686..aee50936 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -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) |