2017-11-08 06:11:49 +00:00
|
|
|
" Author: Taylor Blau <me@ttaylorr.com>
|
|
|
|
|
|
|
|
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
|
|
|
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
|
|
|
let l:output = []
|
|
|
|
|
|
|
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
|
|
call add(l:output, {
|
2020-10-08 15:54:17 +00:00
|
|
|
\ 'filename': l:match[1],
|
2017-11-08 06:11:49 +00:00
|
|
|
\ 'col': l:match[3] + 0,
|
|
|
|
\ 'lnum': l:match[2] + 0,
|
|
|
|
\ 'text': l:match[5],
|
|
|
|
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
|
|
|
\ })
|
|
|
|
endfor
|
2018-09-04 15:51:18 +00:00
|
|
|
|
2020-11-30 18:28:04 +00:00
|
|
|
for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)')
|
|
|
|
call add(l:output, {
|
2021-01-23 17:34:36 +00:00
|
|
|
\ 'filename': l:match[1],
|
2020-11-30 18:28:04 +00:00
|
|
|
\ 'col': l:match[3] + 0,
|
|
|
|
\ 'lnum': l:match[2] + 0,
|
|
|
|
\ 'text': l:match[4],
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ })
|
|
|
|
endfor
|
|
|
|
|
2017-11-08 06:11:49 +00:00
|
|
|
return l:output
|
|
|
|
endfunction
|
|
|
|
|
2020-11-30 18:28:04 +00:00
|
|
|
function! ale_linters#dafny#dafny#GetCommand(buffer) abort
|
|
|
|
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#Set('dafny_dafny_timelimit', 10)
|
2017-11-08 06:11:49 +00:00
|
|
|
call ale#linter#Define('dafny', {
|
|
|
|
\ 'name': 'dafny',
|
|
|
|
\ 'executable': 'dafny',
|
2020-11-30 18:28:04 +00:00
|
|
|
\ 'command': function('ale_linters#dafny#dafny#GetCommand'),
|
2017-11-08 06:11:49 +00:00
|
|
|
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
2017-11-08 17:28:24 +00:00
|
|
|
\ 'lint_file': 1,
|
2017-11-08 06:11:49 +00:00
|
|
|
\ })
|