Uh oh!
There was an error while loading. Please reload this page.
Add support for new error format - #99
Conversation
rust-highfive
commented
Aug 15, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @chris-morgan (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
ExpHP
commented
Aug 16, 2016
It seems the pieces are not all quite there yet. I don't know too much about it all myself, so here is an image comparison of how syntastic looks in both the current version and your PR, and on stable versus nightly: |
jpernst
commented
Aug 17, 2016
Ok, I think the reason for this is that the old errorformat for syntastic had an eager match that prevented the subsequent lines of the new format from matching. I've removed that line; see if this works better now. |
ExpHP
commented
Aug 17, 2016
I added two new images to the album. The new error format messages are now properly integrated into the interface (I can write code again!! 🎉) However there is a discrepancy in where matching ends against the old format error messages. |
jpernst
commented
Aug 17, 2016
Yeah, that extra error message is a bit vexing for me as well. Unfortunately, with how the new error format works, it's completely indistinguishable from a "real" error, and there are several such "noise" messages. I can't think of a good way to deal with this without resorting to lots of hardcoded cases to ignore them all individually. If someone has a better way I'd be interested to know. |
I recall the PR which added the new error messages also says something about a "json mode"). Rummaging around the options it looks one can use It's certainly a less ambiguous format, though I wouldn't dare try parsing it with a regex... I wonder if there is another way to configure these plugins without regex? |
jpernst
commented
Aug 17, 2016
I mentioned this on the internals board, and they seem to indicate that those extra messages aren't final and may be revised, so I'm inclined to just live with them until the dust settles, then we'll see. |
kesselborn
commented
Sep 4, 2016
Hey, I just implemented the (I think) same thing today, but perhaps it's not exactly the same? I wanted to have proper quickfix browsing in the following cases:
If I try out the current pull request, this does not work for me ... or is this PR only for syntastic (which I don't really use) only? Adding the following snippet to " order matters:" newer rustc errors and warningssetlerrorformat=%Eerror%m,%Z\ \ -->\ %f:%l:%c,%Wwarning%m,%Z\ \ \ -->\ %f:%l:%c" older rustc errors and warningssetlerrorformat+=%f:%l:%c:\ %*[0-9]:%*[0-9]\ %trror:%m,%f:%l:%c:\ %*[0-9]:%*[0-9]\ %tarning:%m" cargo test error messages:setlerrorformat+=%E----%m,%Z%m\ %f:%l |
jpernst
commented
Sep 4, 2016
This PR should work (and does for me) with cargo; I'm not sure why it isn't for you. I get errors and warnings from cargo just fine, except for "test" which I haven't added, since I don't usually run that from inside vim. |
MarkSwanson
commented
Sep 6, 2016
kesselborn, your little snippet works great for me (but not quite perfect). Scenarios I tried (via vim :mak):
kesselborn, my test output is rather large and might be breaking things for you. Here is a snippet of what happens when I try to compile test/file.rs on my machine: jpernst - I'm sure it works fine for you on your machine. :-) That's just how it goes sometimes :-) But your patches don't yet handle the new format on my machine. |
MarkSwanson
commented
Sep 6, 2016
Er... it's late and I must be tired because it's no longer taking me to the right file or line number. I've opened up the vim help on errorformat and am playing around. I note the example Python multiline format string uses \C. Playing... |
MarkSwanson
commented
Sep 6, 2016
Ok, I've played around with things a bit. Here's what works for me 100% in every case: I do have 'error' in the ~11000 (eleven thousand) characters that vim has to regex search through. I thought adding the ':\ ' might help but I don't think it did because when I start putting things back like this: Then things don't work anymore. I'm a bit lost in the weeds I think :-) Thanks! |
MarkSwanson
commented
Sep 6, 2016
Ok, I circled back and noticed a bug in the Rust code that generates the error. Bug: It 'non-deterministically' uses 2 or 3 spaces in front of "-->" This is why it 'stopped' working for me earlier - different errors have different spaces. What seems to work for me: Obviously it's a hack for now - but I'm still figuring out the different regex syntax (to support 0-n spaces before '-->') and all of the vim errorformat mechanisms... |
jpernst
commented
Sep 6, 2016
One possibility for why it's not working for some: In the original plugin (and in my PR), the As for detecting the padding, |
MarkSwanson
commented
Sep 6, 2016
Ok, the %# worked like a charm. Thanks! Interesting hunch about the autocmd. I actually don't set 'compiler'. I submit to you that there is tremendous value in allowing people to have a rust compiler other than cargo. Using localvimrc enables me to dynamically change the makeprg. Examples:
Is it possible to just use: (without the 'compiler cargo' qualification) ? Thanks! |
euclio
commented
Sep 6, 2016
@jpernst I think that the rustfmt error parsing needs to be updated as well (or removed entirely...? Shouldn't the errors be reported by rustc anyways?). Since it can't parse the new error format, if there's a syntax error in the |
jpernst
commented
Sep 6, 2016
@MarkSwanson @euclio Huh, I've never even used rustfmt before so I have no idea what's going on there. Perhaps I'll take a look, but if someone else is more familiar with rustfmt and what's supposed to happen wrt errors there, please chime in. |
euclio
commented
Sep 7, 2016
Maybe @grncdr can comment since he wrote that code. Either way, a workaround for now is to set |
grncdr
commented
Sep 8, 2016
to say I wrote it is a bit of an exaggeration, I only hacked the vim-go plugin with some regexes that seemed to work with the toolchain I was using at the time. (it looks like vim-go hasn't changed much since then) IMO the most sensible approach is using |
Filter out more rustc/cargo noise
steveklabnik
commented
Sep 29, 2016
Well, the new errors are out, and I'm a bad maintainer. What's the state of this PR? |
jpernst
commented
Sep 29, 2016
I just updated this yesterday to show all |
steveklabnik
commented
Sep 29, 2016
I am inclined to merge this, then. It seems small enough. Others in this thread, what do you think? |
It has been looking pretty good on nightly. I just dropped into a stable crate to test with Rust 1.12 and this bit of noise about -Z still shows up. (on a tangential but closely related note, it might be a good idea to start pushing for stabilization of |
jpernst
commented
Sep 29, 2016
Hmm, I forgot about that. I'm a little conflicted about filtering that since it indicates that the syntastic plugin will eventually break, but perhap's that's a problem for another day. I'll look into silencing it. |
ExpHP
commented
Sep 29, 2016
I do rather feel the same way! Perhaps keeping it around might make people a little more motivated... ;) |
jpernst
commented
Sep 29, 2016
@ExpHP You make a good point; for now I'll leave that warning in. Also, I pushed some minor adjustments to the syntastic matcher, could you give it a try when you get a chance to make sure everything is still sane? If so, then this should be ready to merge. |
ExpHP
commented
Sep 29, 2016
Still looks good to me (or at least, the parts I use)! I did some comparisons trying to find what changed, and I see that the new commit filters out a bit of noise that I've apparently become blind to (the |
jpernst
commented
Sep 29, 2016
Yeah, having "fake" errors in the list can really mess things up, especially when it tries to jump to the error with no associated location, so I decided it was imporant to remove those from the list finally. Sounds like things are pretty solid now, so unless someone else comes forward with a bug, I think we're good to go. |
jpernst
commented
Sep 30, 2016
After using this for a little while longer, I've been forced to unhide all of the source context in the error messages. This adds back a significant amount of noise, but unfortunately it sometimes contains critical information that isn't otherwise shown, such as the exact types in a type mismatch. Lacking that information hurts more than sifting through the extra noise. |
mbrubeck
commented
Sep 30, 2016
cc #88 |
steveklabnik
commented
Sep 30, 2016
Okay! It's been a day. Let's Thanks all! |
@ExpHP: newbie to rust and rust.vim here, concerning the edit: addressed this by using the nightly |
withoutboats
commented
Oct 6, 2016
I'd really like to see the unstable flag error filtered out of Syntastic's error list. Exposing this to rust.vim users is very frustrating. It is certainly not end users' responsibility to be concerned about the stability of this plugin's integration with rustc. |
@withoutboats : Another way to silence the message is to use Synstatic's option I'm not sure how this affects speed, but I doubt it will match any other errors. |
This adds basic support for the new rustc error format used in recent nightlies. It appears to be working, but it's possible I've missed some edge cases, so comments are welcome.
Also, I'm not at all familiar with syntastic or how it works, so I haven't tested that part yet. If someone who uses that plugin could give this a try and let me know if it's broken, that would be great.