1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
" Author: Atsuya Takagi <asoftonight@gmail.com>
" Description: A linter for Vala using Vala-Lint.
function! ale_linters#vala#vala_lint#GetCommand(buffer) abort
return 'io.elementary.vala-lint %s'
endfunction
function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort
let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(\w\+\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)'
let l:output = []
call add(l:output, {
\ 'lnum': 12,
\ 'col': 30,
\ 'text': 'bad',
\ 'type': 'E',
\ 'code': 'testcode',
\})
"for l:line in a:lines
" let l:match = matchlist(l:line, l:pattern)
" if len(l:match) == 0
" continue
" endif
" let l:line = l:match[1] + 0
" let l:column = l:match[2] + 0
" let l:type = 'E'
" let l:text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
" let l:code = l:match[5]
" call add(l:output, {
" \ 'lnum': l:line,
" \ 'col': l:column,
" \ 'text': l:text,
" \ 'type': l:type,
" \ 'code': l:code,
" \})
"endfor
return l:output
endfunction
call ale#linter#Define('vala', {
\ 'name': 'vala-lint',
\ 'output_stream': 'stdout',
\ 'executable': 'io.elementary.vala-lint',
\ 'command': function('ale_linters#vala#vala_lint#GetCommand'),
\ 'callback': 'ale_linters#vala#vala_lint#Handle',
\ 'lint_file': 1,
\})
|