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.
1 " Author: Scott Bonds <scott@ggr.com>
2 " Description: default Idris compiler
4 call ale#Set('idris_idris_executable', 'idris')
5 call ale#Set('idris_idris_options', '--total --warnpartial --warnreach --warnipkg')
7 function! ale_linters#idris#idris#GetCommand(buffer) abort
8 let l:options = ale#Var(a:buffer, 'idris_idris_options')
10 return '%e' . ale#Pad(l:options) . ' --check %s'
13 function! ale_linters#idris#idris#Handle(buffer, lines) abort
14 " This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat
16 " Look for lines like the following:
17 " foo.idr:2:6:When checking right hand side of main with expected type
19 let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)(-\d+)?:(.*)?$'
22 let l:corrected_lines = []
25 if len(matchlist(l:line, l:pattern)) > 0
26 call add(l:corrected_lines, l:line)
27 elseif len(l:corrected_lines) > 0
29 let l:corrected_lines[-1] .= ' ' " turn a blank line into a space
31 let l:corrected_lines[-1] .= l:line
34 let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g')
38 for l:line in l:corrected_lines
39 let l:match = matchlist(l:line, l:pattern)
45 if !ale#path#IsBufferPath(a:buffer, l:match[1])
49 let l:errors = matchlist(l:match[5], '\v([wW]arning|[eE]rror) - ?(.*)')
52 let l:ghc_type = l:errors[1]
53 let l:text = l:errors[2]
56 let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5]
59 if l:ghc_type is? 'Warning'
66 \ 'lnum': l:match[2] + 0,
67 \ 'col': l:match[3] + 0,
76 call ale#linter#Define('idris', {
78 \ 'executable': {b -> ale#Var(b, 'idris_idris_executable')},
79 \ 'command': function('ale_linters#idris#idris#GetCommand'),
80 \ 'callback': 'ale_linters#idris#idris#Handle',