Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for new error format #99
Conversation
rust-highfive
assigned
chris-morgan
Aug 15, 2016
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
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: |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
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!! |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
ExpHP
commented
Aug 17, 2016
•
|
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? |
This comment has been minimized.
This comment has been minimized.
|
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. |
SergioBenitez
referenced this pull request
Aug 20, 2016
Closed
No syntax highlighting when installed via vim-plug #100
This comment has been minimized.
This comment has been minimized.
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 warnings
setl errorformat=%Eerror%m,%Z\ \ -->\ %f:%l:%c,%Wwarning%m,%Z\ \ \ -->\ %f:%l:%c
" older rustc errors and warnings
setl errorformat+=%f:%l:%c:\ %*[0-9]:%*[0-9]\ %trror:%m,%f:%l:%c:\ %*[0-9]:%*[0-9]\ %tarning:%m
" cargo test error messages:
setl errorformat+=%E----%m,%Z%m\ %f:%l |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
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... |
This comment has been minimized.
This comment has been minimized.
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! |
This comment has been minimized.
This comment has been minimized.
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... |
This comment has been minimized.
This comment has been minimized.
|
One possibility for why it's not working for some: In the original plugin (and in my PR), the As for detecting the padding, |
This comment has been minimized.
This comment has been minimized.
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! |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
euclio
commented
Sep 7, 2016
|
Maybe @grncdr can comment since he wrote that code. Either way, a workaround for now is to set |
This comment has been minimized.
This comment has been minimized.
|
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 |
added some commits
Sep 28, 2016
This comment has been minimized.
This comment has been minimized.
|
Well, the new errors are out, and I'm a bad maintainer. What's the state of this PR? |
This comment has been minimized.
This comment has been minimized.
|
I just updated this yesterday to show all |
This comment has been minimized.
This comment has been minimized.
|
I am inclined to merge this, then. It seems small enough. Others in this thread, what do you think? |
This comment has been minimized.
This comment has been minimized.
ExpHP
commented
Sep 29, 2016
•
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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
referenced this pull request
Sep 29, 2016
Closed
Syntastic compatibility nonfunctional when using nightly #97
This comment has been minimized.
This comment has been minimized.
ExpHP
commented
Sep 29, 2016
|
I do rather feel the same way! Perhaps keeping it around might make people a little more motivated... ;) |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
cc #88 |
steveklabnik
merged commit 2030019
into
rust-lang:master
Sep 30, 2016
This comment has been minimized.
This comment has been minimized.
|
Okay! It's been a day. Let's Thanks all! |
This comment has been minimized.
This comment has been minimized.
irfansharif
commented
Oct 2, 2016
•
|
@ExpHP: newbie to rust and rust.vim here, concerning the edit: addressed this by using the nightly |
euclio
referenced this pull request
Oct 4, 2016
Closed
Errors in source cause file dump in command line if g:rustfmt_autosave is 1 #109
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
Rolandde
commented
Oct 6, 2016
•
|
@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. |
jpernst commentedAug 15, 2016
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.