Sunday, May 22, 2011

Re: quick fix doesn't process info and warning messages correctly

On 22/05/11 12:44 PM, cyboman wrote:
> the lint we are using outputs warnings and info messages. they are all
> in the same format:
> "file_path",line_number message_type message_type_number: message
>
> where message_type is either warning or info
>
> however for some reason when a warning message is followed by an info
> message quick fix puts all of the info message into the warning
> message
>
> here is an example
>
> filepath1,123, Warning 3: this is a warning message 3 for filepath1
> filepath1, 432, Info 4: this is an info message 4 for filepath1
>
> quick fix will display this as follows:
> filepath1|123 warning 4| this is a warning message 3 for filepath 1
> this is an info message 4 for filepath1
>
> here is my errorformat setting:
> set errorformat=%I%p~,%C\"%f\"\\,%l%\\s%\\+Info\ %n:\ %m,%Z " lint
> info with ~
> set errorformat+=%I\"%f\"\\,%l%\\s%\\+Info\ %n:\ %m,%Z " lint info
> set errorformat+=%W\"%f\"\\,%l%\\s%\\+Warning\ %n:\ %m,%Z " lint
> warnings
> set errorformat+=%E\"%f\"\\,%l%\\s%\\+Error\ %n:\ %m,%Z " lint errors
>
> does anybody know why this is happening? any suggestions on how to
> approach this problem?

First, note that it doesn't behave as you claim. I saved your example
into a file, sourced your :set commands then did :cfile on the file
saved earlier, and I got this in the quickfix window:

|| filepath1,123, Warning 3: this is a warning message 3 for filepath1
|| filepath1, 432, Info 4: this is an info message 4 for filepath1

When I changed your example data to this:

"filepath1",123 Warning 3: this is a warning message 3 for filepath1
"filepath1",432 Info 4: this is an info message 4 for filepath1

I could get your results. It would be helpful if you could take a bit
more care to post data that truly does work as you claim in future--i.e.
test it before you push send!

I think the problem is your first :set. The %C rule, being early,
defines Info to be a continuation of a previous message. What are you
trying to achieve with the ~ stuff? It works without it, i.e. with:

set errorformat=%I\"%f\"\\,%l%\\s%\\+Info\ %n:\ %m,%Z " lint info
set errorformat+=%W\"%f\"\\,%l%\\s%\\+Warning\ %n:\ %m,%Z " lint warnings
set errorformat+=%E\"%f\"\\,%l%\\s%\\+Error\ %n:\ %m,%Z " lint errors

Cheers,

Ben.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: