mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
Fix #918 - Save prettier details for Haskell linters
This commit is contained in:
@@ -24,20 +24,25 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
|
||||
let l:corrected_lines = []
|
||||
|
||||
" Group the lines into smaller lists.
|
||||
for l:line in a:lines
|
||||
if len(matchlist(l:line, l:pattern)) > 0
|
||||
call add(l:corrected_lines, l:line)
|
||||
call add(l:corrected_lines, [l:line])
|
||||
elseif l:line is# ''
|
||||
call add(l:corrected_lines, l:line)
|
||||
else
|
||||
if len(l:corrected_lines) > 0
|
||||
let l:line = substitute(l:line, '\v^\s+', ' ', '')
|
||||
let l:corrected_lines[-1] .= l:line
|
||||
endif
|
||||
call add(l:corrected_lines, [l:line])
|
||||
elseif len(l:corrected_lines) > 0
|
||||
call add(l:corrected_lines[-1], l:line)
|
||||
endif
|
||||
endfor
|
||||
|
||||
for l:line in l:corrected_lines
|
||||
for l:line_list in l:corrected_lines
|
||||
" Join the smaller lists into one large line to parse.
|
||||
let l:line = l:line_list[0]
|
||||
|
||||
for l:extra_line in l:line_list[1:]
|
||||
let l:line .= substitute(l:extra_line, '\v^\s+', ' ', '')
|
||||
endfor
|
||||
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
@@ -67,12 +72,19 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
" Replace temporary filenames in problem messages with the basename
|
||||
let l:text = substitute(l:text, l:temp_filename_regex, l:basename, 'g')
|
||||
|
||||
call add(l:output, {
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
\}
|
||||
|
||||
" Include extra lines as details if they are there.
|
||||
if len(l:line_list) > 1
|
||||
let l:item.detail = join(l:line_list[1:], "\n")
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
Reference in New Issue
Block a user