diff options
-rw-r--r-- | autoload/ale/handlers/gcc.vim | 9 | ||||
-rw-r--r-- | test/handler/test_gcc_handler.vader | 16 |
2 files changed, 22 insertions, 3 deletions
diff --git a/autoload/ale/handlers/gcc.vim b/autoload/ale/handlers/gcc.vim index b8bac77f..72d639da 100644 --- a/autoload/ale/handlers/gcc.vim +++ b/autoload/ale/handlers/gcc.vim @@ -92,9 +92,12 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort " the previous error parsed in output if l:match[4] is# 'note' if !empty(l:output) - let l:output[-1]['detail'] = - \ get(l:output[-1], 'detail', '') - \ . s:RemoveUnicodeQuotes(l:match[0]) . "\n" + if !has_key(l:output[-1], 'detail') + let l:output[-1].detail = l:output[-1].text + endif + + let l:output[-1].detail = l:output[-1].detail . "\n" + \ . s:RemoveUnicodeQuotes(l:match[0]) endif continue diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader index 43b38769..3daa9e60 100644 --- a/test/handler/test_gcc_handler.vader +++ b/test/handler/test_gcc_handler.vader @@ -174,6 +174,22 @@ Execute(The GCC handler should handle notes with no previous message): \ '<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): AssertEqual \ [ |