]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/handlers/scala.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 / scala.vim
1 " Author: Nils Leuzinger - https://github.com/PawkyPenguin
2 " Description: Scala linting handlers for scalac-like compilers.
3
4 function! ale#handlers#scala#HandleScalacLintFormat(buffer, lines) abort
5     " Matches patterns line the following:
6     "
7     " /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition
8     let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)'
9     let l:output = []
10     let l:ln = 0
11
12     for l:line in a:lines
13         let l:ln = l:ln + 1
14         let l:match = matchlist(l:line, l:pattern)
15
16         if len(l:match) == 0
17             continue
18         endif
19
20         let l:text = l:match[3]
21         let l:type = l:match[2] is# 'error' ? 'E' : 'W'
22         let l:col = 0
23
24         if l:ln + 1 < len(a:lines)
25             let l:col = stridx(a:lines[l:ln + 1], '^')
26         endif
27
28         call add(l:output, {
29         \   'lnum': l:match[1] + 0,
30         \   'col': l:col + 1,
31         \   'text': l:text,
32         \   'type': l:type,
33         \})
34     endfor
35
36     return l:output
37 endfunction