Felipe Valdes
Felipe Valdes

Reputation: 2217

How can I show multi-line Rust error messages in vim?

I use Syntastic and the error messages in vim usually only have one line, I find this information to be insufficient.

Is there a compiler flag so the first line of the error is more meaningful, or so that I can see multiline errors in the quickfix window? I'm having to constantly go and cargo build the errors somewhere, which should be just a "put mouse in cursor" away, usually the error fits the space (I have a wide monitor).

I'm using macOS.

Upvotes: 8

Views: 2159

Answers (3)

NovaDenizen
NovaDenizen

Reputation: 5305

Do you use :copen? That's the standard way in vim to open a window with the compiler error messages. C-w C-w toggles the cursor between windows. :cnext (or just :cn) jumps to the next error message.

Upvotes: -1

lcd047
lcd047

Reputation: 5861

quickfix windows (actually, loclist windows in the case of syntastic) don't support multiline error messages. This is a limitation of Vim.

What you can do is convince the checker to merge multiline error messages to single lines before parsing them. Syntastic provides hooks for doing that, but cargo is not a standard syntastic checker. So perhaps contact the authors of said checker and post a feature request.

Upvotes: 3

xds2000
xds2000

Reputation: 1194

you need correctly setting the Syntastic and rust bundle in vim. see example in my vimrc(use Vundle):

" vimrc
Plugin 'vim-syntastic/syntastic'
Plugin 'rust-lang/rust.vim'
Plugin 'racer-rust/vim-racer'
Plugin 'timonv/vim-cargo'

" Syntastic
let g:syntastic_error_symbol = 'EE'
let g:syntastic_style_error_symbol = 'E>'
let g:syntastic_warning_symbol = 'WW'
let g:syntastic_style_warning_symbol = 'W>'

let g:syntastic_auto_loc_list = 1
let g:syntastic_rust_checkers = ['cargo']

Upvotes: 1

Related Questions