Tips and Tricks

Tools to understand new code: Enhanced Syntax Coloring

In my previous posts as guest contributor to this blog, I showed you how to use Go-To tools and different Find commands in Visual Assist. In this post, I describe improvements to syntax coloring available in Visual Assist, then close with a description of a tool window that combines several functions of the IDE and Visual Assist.

As in my previous posts, I will use Irrlicht Engine as my example project.

Enhanced Syntax Coloring

Syntax coloring in the IDE—whatever the version—makes code nice to read, and for me, faster to write. But, it’s the enhancements to coloring in Visual Assist that make code really easy to understand.

Let me compare default coloring of an older IDE, VS2008, with that of Visual Assist. (The comparison is similar for newer IDEs.) To the observant programmer, there are some real differences in what the IDE and Visual Assist provide:

blog_color

If you look carefully, Visual Assist uses separate colors for meaningful separation of symbols:

  • classes/structures/types – these appear blue by default, as if they were keywords. I know they won’t change, and I won’t change them.
  • variables – dark blue, or navy to be precise, so I know the symbols have values and can be modified.
  • preprocessor macros – fuchsia, so I know to be cautious in how I use these.
  • methods – also brown, which lets me find quickly the external references in a block of code.

In addition to more meaningful coloring, I can display so-called stable symbols, like function names from third-party libraries, in italics. (See GetSystemInfo and QueryPerformanceFrequency in my example.) The italics tell me nobody has overridden a well-known symbol, and that I can trust its behavior. When I’m surprised not to see a symbol in italics, sometimes I take time to find out what’s different about it.

VA View

I’m going to jump abruptly to one last feature of Visual Assist that is handy for the new user: the VA View. The learning curve for the VA View is a bit steeper than it is for the other commands I’ve described, but I think the effort is worth it.

The VA View is a handy tool that combines several functions of the IDE and Visual Assist, all in a compact interface. I usually make the VA View a tab in the same docked tool window as the Solution Explorer and Class Browser. The VA View gives me most of what I use in the other two tool windows, and I switch to the Solution Explorer or Class Browser only when absolutely necessary.

Here is an example of the VA View, docked to the left of my source window in VS2008:

blog_vaview

From top to bottom, the VA View has:

  • a drop-down for quick opening of any file in my solution. I can type partial matches in the list that opens, letting me find most files faster than I can with the Solution Explorer.
  • a drop-down for quick locating of symbols in my solution. This drop-down also supports filtering. If I know the name of a symbol, or most of it, I can jump to its definition faster than any other method of the IDE.
  • a most-recently-used (MRU) list of files and methods—ones that I’ve recently modified or visited. (Right+click in the MRU to adjust its settings.) Typically, the MRU lets me jump faster than tabbing windows or navigating back with Ctrl+-.
  • a hovering class browser (HCB) that tells me about the symbol I’m hovering over, or class I’m in. (Right+click to adjust this one as well.) In my example, the HCB is showing me SParticle members because my caret is somewhere in SParticle.

Again, the learning curve for the VA View is a little steeper than simpler features of Visual Assist—like syntax coloring. But, the VA View is ready handy and worth the little bit of time it takes to know it. And if you’re a keyboard user, you’ll be happy to know the entire interface to the VA View is available without a mouse.

Summary

In my three-part series, I tried to show new users of Visual Assist how to make use of the tool, especially when you land in front of a completely new code base. The stock IDE has many features to help you, but Visual Assist goes well beyond in functionality and performance.

Learn More

You can learn more about Enhanced Syntax Coloring and the VA View in the documentation for Visual Assist:

This article was contributed by Bartlomiej Filipek, who writes at Code And Graphics — a technical blog about C++ and OpenGL.

Leave a Reply

%d