Thursday, September 18, 2014

Re: Parse an error log and go to the line indicated as being the error?

A quick Google search ("vim errorformat ucc") turns up this wiki page:
http://wiki.beyondunreal.com/Legacy:Vim . It recommends

autocmd FileType uc set makeprg=C:\\UT2003\\system\\ucc\ make
autocmd FileType uc set efm=%f(%l)\ :\ %m

I do not have the environment to test that. I would use setl instead
of set, and I might even make it

autocmd FileType uc let &l:makeprg = 'C:\UT2003\system\ucc make'
autocmd FileType uc let &l:efm = '%f(%l) : %m'

(untested, of course) in order to avoid escaping the spaces and
backslashes. Besides, I am a fan of the "&l:" and related sigils.

In real life, I would have an ftplugin instead of adding autocommands
to myvimrc file, and I might even make this a compiler plugin, but
let's keep it simple for now.

HTH
--
Benji Fisher

On Thu, Sep 18, 2014 at 11:41 AM, David Woodfall <dave@dawoodfall.net> wrote:
>>>
>>> Hi,
>>>
>>> David Woodfall schrieb am 18.09.2014 um 10:25:
>>>>
>>>> Hi, I have a function that calls my make application and if
>>>> compilation fails it brings up a new window at the top of the term
>>>> with the log open in it. All works well but what I'd like to do is
>>>> grab the line from the error message and go to that line in my code
>>>> script.
>>>>
>>>> Here is an example of one such line:
>>>>
>>>> I:\ut99\XConsole\Classes\XConsole.uc(4230) : Error, Unexpected 'i'
>>>>
>>>> So in this example I would like to place the cursor at line 4230.
>>>>
>>>> I can't find much in the way googling for this but I imagine it's
>>>> possible. Perhaps there's a way of setting a variable from the line
>>>> number and then going to it?
>>>>
>>>> Any ideas greatly appreciated.
>>>
>>>
>>> have you tried the :make command inside Vim? It calls the program given
>>> in the 'makeprg' option and parses its output according to the rules
>>> defined by the 'errorformat' option. The default of 'errorformat' should
>>> work in your example and automatically position you on line 423 of
>>> XConsole.uc.
>>
>>
>> Have to say that I haven't used that.
>
>
> It looks like it can't parse the put properly. Here's some sample
> output:
>
> ########################################
> --------------------Core--------------------
> --------------------Engine--------------------
> <snip about another 10 lines like this>
> --------------------UTBrowser--------------------
> --------------------XConsole--------------------
> Analyzing...
> Parsing XConsole_SpawnNotifyActor
> Parsing XConsole_Logger
> Parsing XConsole_IRCLink
> Parsing XConsole_LogActor
> Parsing XConsole_Scanner
> Parsing XConsole
> I:\ut99\XConsole\Classes\XConsole.uc(4229) : Error, Unexpected 'i' Failed
> due to errors.^M
> ^M
> History: CompileError <- TryCompile <- FScriptCompiler::CompileScript
> <- (Class XConsole. XConsole, Pass 0, Line 4229) <- MakeScript
> <- MakeScript <- MakeScript <- MakeScript <- MakeScript <-
> MakeScript <- MakeScript <- DoScripts <- UEditorEngine::MakeScripts
> <- UMakeCommandlet::Main
>
> Exiting due to error
> ###############################
>
> The make command is actually running ucc.exe with wine, if that makes
> a difference?
>
> -Dave
>
>
> --
> --
> 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
>
> --- You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment