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 /ale_linters/cuda | |
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
Diffstat (limited to 'ale_linters/cuda')
-rw-r--r-- | ale_linters/cuda/clangd.vim | 23 |
1 files changed, 23 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'), +\}) |