mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-29 06:12:20 +08:00
Handle ghc panic in haskell (#4145)
* Add primitive handling of ghc panic. * PascalCase in function. * Add simple test.
This commit is contained in:
@@ -19,6 +19,16 @@ let s:temp_regex_prefix =
|
||||
\ . substitute(s:temp_dir, '\\', '\\\\', 'g')
|
||||
\ . '\.\{-}'
|
||||
|
||||
function! s:PanicOutput(lines) abort
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'ghc panic!',
|
||||
\ 'type': 'E',
|
||||
\ 'detail' : join(a:lines, "\n"),
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
@@ -34,6 +44,14 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
|
||||
let l:corrected_lines = []
|
||||
|
||||
" If ghc panic error, put the whole message in details and exit.
|
||||
let l:panic_position = match(a:lines,'ghc: panic!')
|
||||
let l:panic_end = match(a:lines,'Please report this as a GHC bug:')
|
||||
|
||||
if l:panic_position >= 0
|
||||
return s:PanicOutput(a:lines[l:panic_position : l:panic_end])
|
||||
endif
|
||||
|
||||
" Group the lines into smaller lists.
|
||||
for l:line in a:lines
|
||||
if len(matchlist(l:line, l:pattern)) > 0
|
||||
|
||||
Reference in New Issue
Block a user