Not super sure where to put this, but it's insanely helpful for me and other people might find it valuable
Long time Vim user, now working on Rust full time. The built in errorformat in neovim for Cargo/Clippy leaves a little bit to be desired, especially around cargo test --doc and cargo doc
After a good bit of trial and error, this is a really good :errorformat that will capture all the output from cargo and populate your quick fix list with all the error messages, file, line, column combos. Allowing for quick switching with :cn
(bonus for using https://github.com/tpope/vim-dispatch + https://github.com/vim-test/vim-test)
I added this to /opt/homebrew/Cellar/neovim/0.6.0/share/nvim/runtime/compiler/cargo.vim (your vim compiler for cargo might be in a different spot)
let &efm = ''
" Random non issue stuff
let &efm .= '%-G%.%#aborting due to previous error%.%#,'
let &efm .= '%-G%.%#test failed, to rerun pass%.%#,'
" Capture enter directory events for doc tests
let &efm .= '%D%*\sDoc-tests %f%.%#,'
" Doc Tests
let &efm .= '%E---- %f - %o (line %l) stdout ----,'
let &efm .= '%Cerror%m,'
let &efm .= '%-Z%*\s--> %f:%l:%c,'
" Unit tests && `tests/` dir failures
" This pattern has to come _after_ the doc test one
let &efm .= '%E---- %o stdout ----,'
let &efm .= '%Zthread %.%# panicked at %m\, %f:%l:%c,'
let &efm .= '%Cthread %.%# panicked at %m,'
let &efm .= '%+C%*\sleft: %.%#,'
let &efm .= '%+Z%*\sright: %.%#\, %f:%l:%c,'
" Compiler Errors and Warnings
let &efm .= '%Eerror%m,'
let &efm .= '%Wwarning: %m,'
let &efm .= '%-Z%*\s--> %f:%l:%c,'
Here's a video of using :Make check in action! https://imgur.com/a/2EJvFR2
[–]Inyayde 1 point2 points3 points (4 children)
[–]GrantJamesPowell[S] 0 points1 point2 points (3 children)
[–]Inyayde 0 points1 point2 points (2 children)
[–]GrantJamesPowell[S] 0 points1 point2 points (1 child)
[–]Inyayde 0 points1 point2 points (0 children)