All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: blahgeek <i@blahgeek.com>
2 " Description: NVCC linter for cuda files
4 call ale#Set('cuda_nvcc_executable', 'nvcc')
5 call ale#Set('cuda_nvcc_options', '-std=c++11')
7 function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
9 \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
10 \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
11 \ . ' %s -o ' . g:ale#util#nul_file
14 function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
15 " Look for lines like the following.
17 " test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
18 let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
21 for l:match in ale#util#GetMatches(a:lines, l:pattern)
23 \ 'lnum': str2nr(l:match[2]),
24 \ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
26 \ 'filename': fnamemodify(l:match[1], ':p'),
30 let l:item.col = str2nr(l:match[3])
33 call add(l:output, l:item)
39 call ale#linter#Define('cuda', {
41 \ 'output_stream': 'stderr',
42 \ 'executable': {b -> ale#Var(b, 'cuda_nvcc_executable')},
43 \ 'command': function('ale_linters#cuda#nvcc#GetCommand'),
44 \ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',