summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/cuda/clangd.vim23
-rw-r--r--doc/ale-cuda.txt18
-rw-r--r--doc/ale-supported-languages-and-tools.txt1
-rw-r--r--doc/ale.txt1
-rw-r--r--supported-tools.md1
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)