Thursday, November 12, 2015

VSFileNav: Recommended Visual Studio extension for jump-to-filename navigation

Having used Visual Studio 2013 and 2015 as my primary coding IDE for the past 18 months or so, I haven’t been terribly happy with Visual Studio’s out-of-the-box support for the task of using the keyboard to open a file with a particular name (in a large solution).

As detailed in this StackOverflow question, there are a few options, none of which work well for me:

Ctrl+[comma], filename, Enter –This is frequently very sluggish on my (modern) PC, with a delay of 5-10 seconds between the search field appearing, and Visual Studio recovering from being unresponsive and actually allowing typing in the field. Worse, occasionally after typing the Ctrl+[comma] hotkey, the search term that I started typing while the application was still unresponsive (but after the search field appeared), the text I entered gets inserted into the active source code document instead of in the search field!

Ctrl+[semicolon], filename, Enter, Enter – Aside from the drawback of having to hit Enter twice, this leaves the Solution Explorer window in a state of showing only the matches for the entered search term.  To clear the search, either using the mouse or hitting Ctrl+[semicolon], Esc, Esc is needed – obviously not ideal.

Ctrl+Alt+a, of, filename – The Ctrl+Alt+a keyboard shortcut to open the Command Window doesn’t work in my Visual Studio, for whatever reason, even though that shortcut is listed in the Edit menu.  Additionally, the autocomplete in the Command Window frequently messes up my search term. For example, if I’m trying to search for a file named “property.aspx” in my solution, but my solution also has a file named “property-format.aspx”, as soon as I type “property.”, the autocomplete for some reason assumes I want “property-format” and replaces my typed search term with that.  So, no good.

Since none of the out-of-the-box solutions work for me, I resorted to trying a Visual Studio extension that provides this functionality, VSFileNav.

VSFileNav2

VSFileNav is a Visual Studio extension that binds a customizable hotkey – I’m using Ctrl+[tilde] – to open a custom File Navigation dialog allowing quick search and open of all files in the current solution.  Some reasons that VSFileNav is awesome enough that I felt compelled to blog about it:

  • It’s lightning fast. Opening the File Navigation dialog, typing in the dialog to filter filenames in the solution, seeing search results update in real-time as the search term is being typed, and jumping to the selected file upon a press of the Enter key all happen effectively instantly.
  • It supports Pascal-case filename search.  Typing “MCC” into the search field matches “MyCustomClass.cs” as a search result, for example.
  • It just works. I didn’t have to fight with any bugs or configuration settings (beyond setting my preferred hotkey) to make the extension work; I just installed, and it worked great immediately.

VSFileNav, or something like it, really ought to be out-of-the-box functionality in Visual Studio.  But since it isn’t, if you’re a developer using Visual Studio, do yourself a favor and start using VSFileNav.