Sunday, May 22, 2011

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

On May 22, 10:38 am, Ben Schmidt <mail_ben_schm...@yahoo.com.au>
wrote:
> 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.

ben, my apologies for not posting a complete error. and it seems i
have to apologize for not explaining why there is a ~ in the error
format.
the lint tool has two formats for info messages:

info type 1

some line of code
~
"filepath1", 432, Info 4: this is an info message 4 for filepath1


info type 2
"filepath2", 123, Info 5: this is an info message 4 for filepath1

~ shows the column of the line where error/info/warning occurred.
the following errorformat supposed to catch info message with a ~ in
it.
set errorformat=%I%p~,%C\"%f\"\\,%l%\\s%\\+Info\ %n:\ %m,%Z

this one is supposed to catch just a regular info message.
set errorformat+=%I\"%f\"\\,%l%\\s%\\+Info\ %n:\ %m,%Z " lint info

what would i need to do to be able to catch both kinds of info
messages and still make vim process the error file correctly?

--
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: