views:

237

answers:

2

Im trying to get the standard vim :clist, :cope functionality working with vim.

Specifically, I'm trying (and failing) to capture the filename from the compiler output.

I have the PL/SQL code compiling okay (well, when there is no errors =), and I've got errorformat picking up the error messages, line numbers and column numbers, but I can't get it to pick up the filename (which vim needs in order to be able to jump to the file).

This is the best errorformat I've been able to come up with:

  :set efm=%+P[%f],%E%l/%c%m,%C%m,%Z

This is the output from the compiler. It only has the filename on the first line (which I try and pick up with the +P[%f].

output:

[code/voyager/db/db_source/pck_policy_2.pks]

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:51:24 2009    
Copyright (c) 1982, 2005, Oracle.  All rights reserved.    
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
Warning: Package created with compilation errors.    
SQL> Errors for PACKAGE PCK_POLICY_2:

LINE/COL ERROR
-------- --------------------------------------------------------------
21/7     PLS-00103: Encountered the symbol "EXP_PBIT_ID" when expecting
         one of the following:
         := . ) , @ % default character
         The symbol "," was substituted for "EXP_PBIT_ID" to continue.

185/1    PLS-00103: Encountered the symbol "END" when expecting one of the
         following:
         constant exception <an identifier>
         <a double-quoted delimited-identifier> table long double ref
         char time timestamp interval date binary national character
         nchar

LINE/COL ERROR
-------- -------------------------------------------------------------

SQL> Disconnected from Oracle Database 11g Enterprise Edition

:clist afterwards shows the errors have been caught, but not the filename: :clist

19:21 col 7 error: PLS-00103: Encountered the symbol "EXP_PBIT_ID" when expecting one of the following: := . ) , @ % default character The symbol "," was substituted for "EXP_PBIT_ID" to continue.
21:185 col 1 error: PLS-00103: Encountered the symbol "END" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table long double ref char time timestamp interval date binary national character nchar

Does anyone know how I can make this pick up the filename?

Thanks Dave Smylie

A: 

Knowing NOTHING about efm or vim or this parsing you are trying to do, I would say that you might have better luck performing a query to get the error information. Check out the view user_errors to gather the error information. It should be easier to get the data the way you want using this method.

Adam Hawkes
+1  A: 

The syntax you're using looks OK to me. So all I have to offer is thoughts...

  1. Even though the file names are not displayed, can you still jump to the correct line in the quickfix window?
  2. Does the compiler produce any output before the file name? Tried a %E before the %+P?
  3. Even though it's not the error format you are looking for, have you tried the oracle.vim plugin?
DaveParillo
I've ended up writing a shellpipe script to filter the output and remove all non-revelant output, and putting the rest into a more sane format. Now The error format I have is: "filename" line ##: Error message. eg "/home/dgs/code/voyager/db/db_source/pck_policy_2.pkb" line 38: PLS-0103- Encountered the symbol EXC_POLICY_NOT_FOUND And the errorformat I'm working with: set errorformat=\"%f\"\ line %l: \mStill not capturing the results correctly thru - it won't jump anywhere...(Had a look at the oracle.vim plugin - doesn't hook into the quickfix system though afaict)
Dave Smylie
If you've already filtered this, I would simplify it by not using the quotation mark, unless you have do handle spaces I guess. Also, I think efm may be alot more forgiving if you put the %f at the end. The "%f" conversion has to detect the end of the string. Itshould be followed by a character that cannot be in the string. If the %f is at the end, everything up to the end of the line is included.
DaveParillo
Also, now I'm wondering what version of vim you're using. gvim? not sure if it's relevant...
DaveParillo