Fix parsing of cl error messages in vim so that it differentiates between an error and warning!
This commit is contained in:
parent
06f155f3f7
commit
221985eca2
55
vimrc
55
vimrc
|
@ -1101,23 +1101,60 @@ augroup END
|
||||||
" AsyncRun status line
|
" AsyncRun status line
|
||||||
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
||||||
|
|
||||||
" Display error highlighting in source after running GCC with AsyncRun
|
" "make" value is needed for asyncrun to work with the errormarker plugin
|
||||||
" NOTE: error results can be cleared with <leader>cr or by hiding the build
|
" https://github.com/skywind3000/asyncrun.vim/wiki/FAQ#can-asyncrunvim-trigger-an-autocommand-quickfixcmdpost-to-get-some-plugin-like-errormaker-processing-the-content-in-quickfix-
|
||||||
" result window.
|
|
||||||
let g:asyncrun_auto = "make"
|
let g:asyncrun_auto = "make"
|
||||||
|
|
||||||
|
" Error and warning gutter characters.
|
||||||
let errormarker_errortext = "E"
|
let errormarker_errortext = "E"
|
||||||
let errormarker_warningtext = "W"
|
let errormarker_warningtext = "W"
|
||||||
|
|
||||||
" Thanks to https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982
|
" Error and warning gutter character colors. See color file for the group definition.
|
||||||
" for the error message formats
|
let errormarker_errortextgroup = "ErrorMsg"
|
||||||
"
|
let errormarker_warningtextgroup = "Notices"
|
||||||
" Microsoft MSBuild errors
|
|
||||||
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m
|
"""""""""""""""""""""""""
|
||||||
|
" Custom error formats
|
||||||
|
"""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" @note: You can debug the error parsing by running :ShowErrorEntries
|
||||||
|
" This will print the valid entries. You'll know parsing is correct when the
|
||||||
|
" entries have a type, line num, error message, etc.
|
||||||
|
|
||||||
|
function! s:ShowErrorEntries()
|
||||||
|
" Prints out valid quickfix errors.
|
||||||
|
redraw!
|
||||||
|
for l:d in getqflist()
|
||||||
|
if l:d.valid == 1
|
||||||
|
echomsg l:d
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
command -nargs=0 ShowErrorEntries call s:ShowErrorEntries()
|
||||||
|
|
||||||
|
|
||||||
" Microsoft compiler: cl.exe
|
" Microsoft compiler: cl.exe
|
||||||
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
|
"
|
||||||
|
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||||
|
set errorformat=\\\ %#%f(%l):\ %#%t%[A-z]%#\ %[A-z]%#%n:\ %m
|
||||||
|
|
||||||
|
" Microsoft MSBuild errors
|
||||||
|
"
|
||||||
|
" @note I got this off the Internet and haven't tested it yet.
|
||||||
|
"
|
||||||
|
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||||
|
set errorformat+=\\\ %#%f(%l\\,%c):\ %m
|
||||||
|
|
||||||
" Microsoft HLSL compiler: fxc.exe
|
" Microsoft HLSL compiler: fxc.exe
|
||||||
|
"
|
||||||
|
" @note I got this off the Internet and haven't tested it yet.
|
||||||
|
" @todo Add an example
|
||||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""
|
||||||
|
" Build functions
|
||||||
|
"""""""""""""""""""""""""
|
||||||
|
|
||||||
function! HideBuildResultsAndClearErrors()
|
function! HideBuildResultsAndClearErrors()
|
||||||
RemoveErrorMarkers
|
RemoveErrorMarkers
|
||||||
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
|
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user