]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/handlers/naga.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / autoload / ale / handlers / naga.vim
1 " Author: rhysd <https://github.com/rhysd>
2 " Description: Handle errors for naga-cli.
3
4 function! ale#handlers#naga#Handle(buffer, lines) abort
5     let l:errors = []
6     let l:current_error = v:null
7
8     for l:line in a:lines
9         if l:line =~# '^error: '
10             let l:text = l:line[7:]
11             let l:current_error = { 'text': l:text, 'type': 'E' }
12             continue
13         endif
14
15         if l:current_error isnot v:null
16             let l:matches = matchlist(l:line, '\v:(\d+):(\d+)$')
17
18             if !empty(l:matches)
19                 let l:current_error.lnum = str2nr(l:matches[1])
20                 let l:current_error.col = str2nr(l:matches[2])
21                 call add(l:errors, l:current_error)
22                 let l:current_error = v:null
23                 continue
24             endif
25         endif
26     endfor
27
28     return l:errors
29 endfunction
30