summaryrefslogtreecommitdiff
path: root/autoload/ale/handlers/deadnix.vim
blob: 8f03f38e11a85750440eb6bf240aefb567163c31 (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
function! ale#handlers#deadnix#Handle(buffer, lines) abort
    let l:output = []

    for l:line in a:lines
        try
            let l:file = ale#util#FuzzyJSONDecode(l:line, v:null)
        catch
            continue
        endtry

        if type(l:file) isnot v:t_dict
            continue
        endif

        for l:error in l:file['results']
            try
                let l:ale_error = {
                \   'lnum': l:error['line'],
                \   'col': l:error['column'],
                \   'end_col': l:error['endColumn'],
                \   'text': l:error['message'],
                \   'type': 'W',
                \}
            catch
                continue
            endtry

            call add(l:output, l:ale_error)
        endfor
    endfor

    return l:output
endfunction