blob: fe1d2f68f0b3460edb686b045d7544ab6ea073c3 (
plain)
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
53
|
" vim: ts=4 sw=4 et
function! neomake#makers#ft#elm#EnabledMakers() abort
return ['elmMake']
endfunction
function! neomake#makers#ft#elm#elmMake() abort
return {
\ 'exe': 'elm-make',
\ 'args': ['--report=json', '--output=' . g:neomake#compat#dev_null],
\ 'process_output': function('neomake#makers#ft#elm#ElmMakeProcessOutput')
\ }
endfunction
function! neomake#makers#ft#elm#ElmMakeProcessOutput(context) abort
let errors = []
" output will be a List, containing either:
" 1) A success message
" 2) A string holding a JSON array for both warnings and errors
for line in a:context.output
if line[0] ==# '['
let decoded = neomake#compat#json_decode(line)
for item in decoded
if get(item, 'type', '') ==# 'warning'
let code = 'W'
else
let code = 'E'
endif
let compiler_error = item['tag']
let message = item['overview']
let filename = item['file']
let region_start = item['region']['start']
let region_end = item['region']['end']
let row = region_start['line']
let col = region_start['column']
let length = region_end['column'] - region_start['column']
let error = {
\ 'text': compiler_error . ' : ' . message,
\ 'type': code,
\ 'lnum': row,
\ 'col': col,
\ 'length': length,
\ 'filename': filename,
\ }
call add(errors, error)
endfor
endif
endfor
return errors
endfunction
|