Include the error in the detailed error message in the GCC handler

This commit is contained in:
w0rp 2018-08-02 21:45:04 +01:00
parent 6b3086237a
commit ccbdfcd76f
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
2 changed files with 22 additions and 3 deletions

View file

@ -92,9 +92,12 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
" the previous error parsed in output " the previous error parsed in output
if l:match[4] is# 'note' if l:match[4] is# 'note'
if !empty(l:output) if !empty(l:output)
let l:output[-1]['detail'] = if !has_key(l:output[-1], 'detail')
\ get(l:output[-1], 'detail', '') let l:output[-1].detail = l:output[-1].text
\ . s:RemoveUnicodeQuotes(l:match[0]) . "\n" endif
let l:output[-1].detail = l:output[-1].detail . "\n"
\ . s:RemoveUnicodeQuotes(l:match[0])
endif endif
continue continue

View file

@ -174,6 +174,22 @@ Execute(The GCC handler should handle notes with no previous message):
\ '<stdin>:1:1: note: x', \ '<stdin>:1:1: note: x',
\ ]) \ ])
Execute(The GCC handler should attach notes to previous messages):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 12,
\ 'type': 'E',
\ 'text': 'Some error',
\ 'detail': "Some error\n<stdin>:1:1: note: x",
\ },
\ ],
\ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '-:6:12: error: Some error',
\ '<stdin>:1:1: note: x',
\ ])
Execute(The GCC handler should interpret - as being the current file): Execute(The GCC handler should interpret - as being the current file):
AssertEqual AssertEqual
\ [ \ [