alt+g in Comments

If you don’t read our build change history page, you might miss some small gold nuggets.  For example, back in build 1734, we added an enhancement to our goto command (alt+g) so that it operates within comments.  The accuracy of goto within comments depends upon uniqueness of identifier name and context of the comment, and there will be plenty of cases where it can’t figure out what you want it to figure out, but it works enough to bring it to your attention.

Open File in Solution tip

I was using the OFIS (Open File in Solution) dialog the other day and it occurred to me that I use some features in it that might not be so apparent to users that didn’t actually write the code for it.  As an aside, this feature was formerly known as Open File in Workspace (or OFIW) before Workspaces were replaced by Solutions in Visual Studio.NET.  It took us a few years after the release of Visual Studio.NET to get around to updating the name (I supposed we had to accumulate a few “What’s a workspace?” queries from new users before making the update).

At any rate, here’s a tip for the OFIS dialog:  you can use the Up and Down arrow keys as well as the Page Up and Page Down keys to navigate up and down through the file list while focus is still in the edit control.  No need to tab around or click in the list to change the selection after having typed in the edit control to filter the list.

This also applies to the Find Symbol in Solution (FSIS) dialog.

Add Include

We recently released a feature for C/C++ that has long been requested: Add Include.  A lot of work had previously been put into our #include completion listboxes – but that work is moot because now you don’t need to type #includes directives by hand.

The Add Include command is available when you place the caret on a symbol which is declared in a header file that is not directly included in the active file.

If the header that the symbol is defined in is already directly included in the current file, the command is disabled.  Otherwise, it is enabled – even though the dependency may already be satisfied by another directive that itself #includes the header.  This is by design as many programming style guidelines mandate explicit inclusion of declarations (as opposed to happenstance or indirect inclusion).

For types and functions, Add Include straightforwardly adds an include directive for the header in which the type or function is declared.  For variables that are declared in the active file, Add Include acts on the type of the variable (no need to go to the declaration of the variable to add the include for its type).  For variables that are not declared in the active file, Add Include operates in the same way as it does for types and functions.

While the command is available in the usual VA Refactor menus, the easiest way to invoke it (at least for keyboardists) is to place the caret on a symbol and press alt+x, r, n.

VA Snippet Tip #1

VA Snippets support a number of reserved strings that enable text substitution when inserted into the text editor.  For example, any occurrence of $selected$ in a snippet is replaced with the actual text editor selection at the time the snippet was invoked.

As noted in a previous post, VA Snippets support shortcuts.  You wouldn’t want to use the $selected$ reserved string with a snippet that you want to invoke via a shortcut since typing the shortcut will overwrite your text selection (in this case, occurrences of $selected$ would simply be removed from the snippet when it is inserted into the text editor).

Instead of using the $selected$ reserved string, use $clipboard$.

Now you can use a shortcut to invoke the snippet with one small extra step:

  • Make your text selection
  • Copy (or Cut)
  • Type the shortcut and accept the snippet suggestion

Methods in File

Here’s a quickie…

When you are in a source window, pressing Alt+M displays the VA X Methods in File list.

Did you know you can filter the list by typing after the list is displayed?  Yeah, most people know that.

Did you know you can filter using multiple strings as in the OFIS and FSIS dialogs?  You can, as of build 1645 (2008.07.10).  The filter supports the use of ‘-‘ to exclude items.

Support for Incomplete Solutions

Several members of the Whole Tomato Software crew attended the Seattle XNA Gamefest held back in July.  It was a great opportunity for us to get face time with quite a few of our customers.  We received a lot of feedback some of which has bubbled up in VA X 10.5.

We learned that many Visual Studio users only work in the IDE for editing and debugging but not for doing builds.  Because it is not being used for builds, people are working with solutions that are empty or are incomplete, adhoc file collections.

To address editing and navigation productivity in these scenarios, we have added optional support for directory based file discovery. If enabled, VA X will scan for files that are in the same directory as any opened file.  Newly discovered files (those which are not already explicitly listed in the solution) are treated as part of the solution in the eyes of VA X.  The files are listed in the VA X file lists (OFIS and VA View) and symbols declared in them are listed in the VA X symbol lists (FSIS and VA View).

File discovery is controlled via two settings on the Projects|File Handling node of the VA X Options dialog.  The first setting enables this support for only when the loaded solution is empty.  The second enables it independently for when files are present in the loaded solution.  The first setting is enabled by default whereas the second is disabled.  If you use partial solutions as described above, then we recommend enabling the second option.

Versionitis (of the host environment)

Yesterday, I posted about a new feature in VA X 10.5.  I failed to mention that the new feature is only supported in Visual Studio versions starting with Visual Studio.NET (vs2002+).  While we continue to support VC++ 6, not all features we introduce going forward will be available in that environment.  That said, we don’t currently have any plans to end VC++ 6 support.

For those of you still using VC++ 6, care to share why?  Are you still using the VC++ 6 compiler and libraries, or have you modified the build environment to use different tools?

Mark All Occurrences

Highlight Find Results is a new feature in Visual Assist X 10.5.  By default, this feature tracks your standard Find commands and highlights all of the find results in the text editor.  Some people may not want this feature enabled by default and would rather manually invoke highlighting.  Here’s how.

First, to disable the default behavior, uncheck the “Highlight find results” option on the Advanced | Display page of the Visual Assist X Options dialog.

Next, create a keybinding to invoke VAssistX.FindSelected.  Open the IDE Options dialog and navigate to Environment | Keyboard.  Type “findsel” into the “Show commands containing” edit control.  Select “VAssistX.FindSelected” in the command list.  Select “Text Editor” in the “Use new shortcut” list.  Press Alt+K in the shortcut keys control.  Press Assign and OK.

Now, you can press Alt+K on any word (or selection) in the editor to highlight all occurrences of the word (or selection).  The command also updates the Find text so that F3 will move the caret to the next occurrence.  Unlike Ctrl+F3, when you press Alt+K, the caret will not change position.  Press escape to clear the highlighting.

Refresh Find References

Find References is great at locating references to symbols across your solution.  But did you know that when you just want to search the active file, you can use the Find References in File command?  You get a shorter search duration and the results list window is the same one you use with Find References.

The Find References results list has a Refresh button that allows you to re-execute a search without moving your caret to an occurrence of the symbol for which you last searched.

For the standard Find References command, Refresh is straightforward: search the solution again.  But what about Find References In File?  Refresh executes the search in the active file – not necessarily the same file that was active for the first set of results.

Bug or feature?

Using Qt 4.4 with Visual Assist

If you are using Visual Studio with Qt, you can ensure a more productive experience by adding the Qt directories to your Visual Studio list of includes.

In Visual Studio, add the following directories to the Win32 Platform Include files list (Tools|Options|Projects and Solution|VC++ Directories):

  • $(QTDIR)\include
  • $(QTDIR)\include\Qt
  • $(QTDIR)\include\QtCore
  • $(QTDIR)\include\QtGui
  • $(QTDIR)\include\QtHelp
  • $(QTDIR)\include\QtNetwork
  • $(QTDIR)\include\QtOpenGL
  • $(QTDIR)\include\QtScript
  • $(QTDIR)\include\QtSql
  • $(QTDIR)\include\QtSvg
  • $(QTDIR)\include\QtTest
  • $(QTDIR)\include\QtUiTools
  • $(QTDIR)\include\QtWebKit
  • $(QTDIR)\include\QtXml
  • $(QTDIR)\include\QtXmlPatterns
  • $(QTDIR)\src

Make sure that the QTDIR environment variable has been defined (or else manually substitute the Qt directory for $(QTDIR) in the list items).

In the VA X Options dialog, Platform should be set to Win32 (VAssistX|Visual Assist X Options|Projects|C/C++ Directories).

VA X will parse included Qt header files the next time you open a solution that uses Qt.  If you have the Stable symbols in italic option enabled, Qt symbols will be displayed in italics.