]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/handlers/cairo.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 / cairo.vim
1 " Author: 0xhyoga <0xhyoga@gmx.com>,
2 " Description: This file implements handlers specific to Cairo
3 "
4 function! ale#handlers#cairo#HandleCairoErrors(buffer, lines) abort
5     " Matches patterns like the following:
6     " Error: Expected ';' but got '('
7     "    --> /path/to/file/file.cairo:1:10:)
8     let l:pattern = '\v(error|warning): (.*)$'
9     let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)'
10     let l:exclude_pattern = '\vcould not compile.*'
11     let l:output = []
12
13     for l:line in a:lines
14         let l:match = matchlist(l:line, l:pattern)
15
16         if len(l:match) == 0
17             let l:match = matchlist(l:line, l:line_and_column_pattern)
18
19             if len(l:match) > 0
20                 let l:index = len(l:output) - 1
21                 let l:output[l:index]['lnum'] = l:match[1] + 0
22                 let l:output[l:index]['col'] = l:match[2] + 0
23             endif
24         else
25             let l:text = l:match[2]
26
27             if l:text !~# l:exclude_pattern
28                 let l:isError = l:match[1] is? 'Error'
29
30                 call add(l:output, {
31                 \   'lnum': 0,
32                 \   'col': 0,
33                 \   'text': l:text,
34                 \   'type': l:isError ? 'E' : 'W',
35                 \})
36             endif
37         endif
38     endfor
39
40     return l:output
41 endfunction