"Syntax" coloring in Tool Windows

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

"Syntax" coloring in Tool Windows

Post by pwdiener »

Is there any way to do text coloring in a tool window? I've got compiler error output like this:

Code: Select all

C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (376)   * 3091  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  037600  No INPUT fields found for format PC41810201.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810301.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810302.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC4181030X.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810303.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810304.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810305.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810306.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 30  SEQNBR:  038200  No INPUT fields found for format PC41810307.
C:\code\Peterson\qsys.lib\LPUSR500.LIB\QLBLSRC.FILE\PCC1810.CBL (382)   * 3112  MSGID: LBL0600  SEVERITY: 10  SEQNBR:  038200  No INPUT fields found for format PC41810308.
and what I would like to do is to have the SEVERITY: 30 stand out as, for example black text on red. Using right-click Properties on the tool window, I've defined keywords and coloring for various severity levels, both including the SEVERITY: prefix and with just the number, but no joy. Any ideas?

Bill
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

You need to edit the Zeus Document Type and more specifically you need to change the Tool Display section found in the Coloring panel.

If you look at this Tool section you will notice there are fewer categories than for the normal Document display.

These categories map to the Keywords panel, so in other words Tool don't use all the options in the keyword section of the document type.

So for example Tools don't use the Delimiters or Reserved Words section of the document type.

This means to make the coloring work you need pick the correct section and also include the delimiters in the keyword.

For example put this word into the User Words 1 section and it should color.
SEVERITY:
Cheers Jussi
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post by pwdiener »

Thanks, that did the trick. I actually ended up with the Compiler Output View coloring instead of Tool Output View, but that was the clue I needed.

I also discovered that the Errors coloring appears to take precedence - I had a errors regex defined for the source document type and it was applied to the entire error line (as expected), but also prevented my coloring just part of the line. When I removed it, the word coloring worked as expected.

Another question - can you think of a way to scroll the compiler error output to the left? The file names are rather long and they push the error message text off to the right of the screen. I tried writing a macro to invoke the compile (using the CompilerCompile keyboard function) , then scroll the output left, but it appears that the CompilerCompile operates asynchronously, because I scrolled the source program left, then later displayed the compile output.

Bill Diener
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post by pwdiener »

Whoops, a little too hasty. Actually, removing the error regex has some undesirable side effects - Zeus no longer thinks the compile has any errors, so displaying the error messages doesn't work anymore. The cursor is then positioned on the first output line instead of the first error message - that in itself is not a big deal but then the CompilerErrorNext (etc.) functions don't work anymore.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Bill,
I also discovered that the Errors coloring appears to take precedence - I had a errors regex defined for the source document type and it was applied to the entire error line (as expected), but also prevented my coloring just part of the line. When I removed it, the word coloring worked as expected.

Errors are a little more complicated and a lot harder to understand.

Consider for example running a compile on a document window that results in a output window with the compile errors.

The definition of what is an error is not related to the output window, but instead relates to the original document compiled.

In other words the error regexp is not defined in the output window document type, but instead is found in the document type of the original document.

So to make this work Zeus needs to do some document type magic under the hoods.
Another question - can you think of a way to scroll the compiler error output to the left?

You should be able to write a macro to do this. The set_cursor_pos macro function should be able to do this and there are also a bunch of scroll keyboard functions that might also work.
I tried writing a macro to invoke the compile (using the CompilerCompile keyboard function) , then scroll the output left, but it appears that the CompilerCompile operates asynchronously
By default it is asynchronous. But what should work is having the macro wait for the compile to finish and then creating the output window only when the compile is done.

You need to use the wait option found in the system macro function and the file_open_compiler macro function to create the window.

There are also examples of Zeus waiting for to tools to complete here: http://www.zeusedit.com/zforum/viewtopic.php?t=6668

and here: http://www.zeusedit.com/zforum/viewtopi ... encompiler

and also in this script: zScript\go_exec.py

Cheers Jussi
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post by pwdiener »

So with Errors, the coloring is applied to the entire line without the ability to color individual words on the line? That's what I'm seeing.

For me, the ability to use the error navigation functions (CompilerErrorNext, etc.) outweigh the advantages of coloring, but it would be nice to have both capabilities. The code base I'm working with right now is riddled with compiler warnings that make the true errors a bit harder to spot and so less productive than might be.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

So with Errors, the coloring is applied to the entire line without the ability to color individual words on the line? That's what I'm seeing.

Yes. That is correct.

Cheers Jussi
Post Reply