Visual Studio Find File in Solution Explorer
Visual Assist provides two efficient methods to find and open files in your solution:
- Files in Solution drop-down in the VA View, which is often visible when editing
- Open File in Solution (OFIS) dialog that is opened on demand, and is more powerful than the drop-down
Keyboard access, speed, and filtering make these methods more efficient than the built-in Solution Explorer and FileView.
Visual Assist opens files using the appropriate applications, e.g. the text editor for resource scripts. Unsupported file types, such as library files, are listed but cannot be opened.
Visual Assist versus Visual Studio
Visual Studio 2017 provides Go-to-File, which provides some of the functionality of Open File in Solution. The Visual Assist implementation of the feature also supports searching of a wider scope, negative filtering, opening of multiple files, opening of enclosing folders, logical-or matching, opening to line numbers, opening via path, and sorting of matches.
Files in Solution Drop-down
The Files in Solution drop-down is the first component of the VA View. The interface to the drop-down is simple and fast, and sufficient if you know some or all of the filename you wish to open.
If the VA View is not open, open it with VAssistX | Tools | VA View or via a shortcut assigned to VAssistX.VAView.
Put focus in the drop-down, and type one or more strings to reduce the list of all files in your solution to those containing the strings. Filtering in the drop-down is always case insensitive.
Use negative filtering to exclude entries.
Use commas to search for entries that match any one of multiple filters.
Hover over entries in the drop-down to see file locations.
Navigate the drop-down with keyboard or mouse.
Open a file using Enter or Click.
Open File in Solution Dialog
Open a more comprehensive dialog of filenames with the default shortcut (Shift+Alt+O), alternate shortcut for VAssistX.OpenFileInSolutionDialog, or toolbar button.
Hover over truncated filenames to see full paths.
Open files using Click and Enter.
Shift+Click and Ctrl+Click to open multiple files in a single operation.
Open the context menu to access additional commands available to the current selection.
Visual Studio 2010 and newer
If you use the default keyboard mapping scheme, Shift+Alt+O is available only in the scope of the text editor. Therefore, you must open a file via an alternate method before you can use the shortcut.
If you want to use Shift+Alt+O at global scope, accept the recommended shortcuts of Visual Assist, or manually remove the binding between Shift+Alt+O and File.OpenWebSite and increase the scope of the binding for VAssistX.OpenFileInSolutionDialog.
Filtering in the Dialog
Type a string in the edit field of the dialog to filter the list. By default, Visual Assist selects a file whose base name—not path—begins with the filter, and centers the file among all files whose base names contains the filter. If no file begins with the filter, Visual Assist selects the first file whose name contains the filter.
Type unique filters to locate files quickly. Type multiple strings to find files whose names contain all of the strings.
Precede a string with a hyphen to exclude files (negative filtering).
Begin a filter with a dot to find files that begin with the filter, or contain the dot and substring. A filter that ends with a dot matches ends of file names. For example "string." finds files whose base names end with "string". This dot filtering is also possible in other dialogs of Visual Assist that support filtering.
Use commas to search for entries that match any one of multiple filters.
Type or paste a fully qualified file name into the edit field to "filter" to a specific file, even if the file does not appear in the dialog list.
Persistent Filtering in the Dialog
A second edit field, whose value persists across dialog invocations and applies to all searches, can be made visible using the context menu of the dialog.
Enter filtering strings to persist to all searches. For example, enter "-.moc_" to hide Qt files that begin "moc_".
If you hide the second edit field, its filters continue to be applied to all searches.
Disable the persistent filter by pressing Ctrl+R in the dialog, or by clearing the second edit field.
If a persistent filter is active, whether or not the respective edit field is visible, the number of all files to be searched is determine before the persistent filter is applied. Hence, if a persistent filter is active, the count may be larger than the number of files visible when the dialog opens.
Scope and Sources of Files in the Dialog
If the option to show only files in the current solution is checked, the list is limited to files added to any project in a solution.
Use the context menu of the dialog to broaden the list to include all files in solution directories.
If the option to show only files in the current solution is unchecked, use the context menu to exclude or include numerous sources of files. The project column will identify the respective sources.
Source | Definition | Project Column |
---|---|---|
Solution Files | Files expressly added to any project in a solution | Respective project names |
All files in solution directories | Files in any directory containing a solution .sln or .vcxproj file Files in any subdirectory of a parent directory that contains a .git subdirectory, excluding files in the .git subdirectory Files in a subdirectory of a .sln or .vcxproj directory, but not in a subdirectory that begins with a dot, e.g. .vs, .git, or .ssh Files hidden by extension are excluded by default. | [Solution] |
Files hidden by extension | Files in a solution directory with an extension listed in Tools | Options | Projects and Solutions | VC++ Project Settings | Extensions to Hide Files in a solution directory with an extension that Visual Assist is programmed to ignore, e.g. exe | [Solution] |
Private system files | Files in NuGet packages installed to a solution If a solution is folder-based, files in directories whose path name contains "3rd party", "3rdparty", "thirdparty", or "third party". (Change via registry setting.) | [NuGet] |
Shared system files | Files in Vcpkg libraries Solution files that have paths containing "\Program Files". Such files are considered both solution files and shared system files. If platform is "Project defined" on the C++ Directories page of the options dialog for Visual Assist, files found using Project Properties | Configuration Properties | VC++ Directories | Include Directories and Source Directories—for all projects in a solution If platform is "Custom" in the options dialog, files in directories specified for "System include files" and "Source files" | [Vcpkg] or [System] |
External files | Files #included by a solution, not already designated as a solution file, private system file, or shared system file Files can be found via directory of other solution files, via any Project Properties | Configuration Properties | C/C++ | Additional Include Directories, or via any relative or absolute path in an #include directive. | [External] |
Open files | Files active in a text editor of Visual Studio, not already designated as from another source | [Open] |
Projects in the Dialog
If a file belongs to multiple projects, it will appear in the dialog multiple times unless the option to combine entries is set.
You can change the setting to combine duplicates in the context menu of the dialog when focus is in the list of files, not the edit control. If combining is enabled, hover over the project column to see all projects to which a file belongs.
Filtering on Path in the Dialog
Precede a filter with a backslash to use it locate files based on path, which is especially useful to locate a commonly named file in a multi-project solution. (Path filtering is available in the dialog only, i.e. not the drop-down.)
Opening to a Line Number from the Dialog
Follow a filter or fully qualified file name with a qualifier to open a file at a specific line and, optionally, a character position. Accepted formats for qualifier include:
Format | Honored | Example Filters |
---|---|---|
:NN | When any single item is selected in the dialog list | src action:15 src action :15 |
:NN (NN) (NN,CC) | After a trailing filter that has a file extension | action.cpp:15 action.cpp :15 src action.cpp(15,40) C:\Users\tomato\vs2015\warzone2100-code\src\action.cpp (15,40) |
Case-Sensitive Filtering in the Dialog
By default, filtering is case insensitive. If you enable matching on case in the context menu of the dialog list, i.e. not of the edit control, you can filter on case. When enabled, filtering is restricted to files matching case if a filter contains any uppercase letters.
Without the setting enabled, "setup" matches "setup" and "Setup". With the setting enabled, "setup" matches "setup" and "Setup", but "Setup" matches only "Setup".
If you need to find only "setup" with the setting enabled, search for "setup -S"; the negative filter will eliminate "Setup".
Sorting in the Dialog
By default, files are sorted alphabetically by base filename. Click a column header to sort by the column. Click again to reverse the sort order.
Scrolling in the Dialog
Standard scrolling techniques are available in the Open File in Solution dialog when focus is in the list.
Although non-standard UI, when focus is in the filter edit control, Home and End scroll the list if no filter is present. Once you start typing a filter, the Home and End keys move the text caret in the filter edit control, whereas the Up, Down, PgUp, PgDn, Ctrl-Home, and Ctrl-End continue to scroll the list.
Tooltips in the Dialog
Use the Tooltips entry in the context menu of the dialog to show or hide the tooltips that appear when hovering.
If you hide the tooltips, they will still appear when hovering over truncated cells.
Interrupt Loading of the Dialog
Loading of a dialog that includes files beyond the current solution can be interrupted by pressing Esc or clicking the Stop button.
Interrupting affect only loading of non-solution files. If an interrupt was effective, the dialog will contain all solution files and a partial list of non-solution files.
Last Filter and Selection in the Dialog
The Open File in Solution dialog remembers your last filter(s) and last selection when you reopen the dialog. This behavior lets you open successive items easily.
MRU
Files opened using the Files in Solution drop-down appear automatically in the Most Recently Used (MRU) component of the VA View. Files opened using the dialog appear only if the "Include opened files" option is enabled in the MRU.
Directory-Based Parsing
If you use directory-based parsing—specified in the Projects and Files pane of the Visual Assist options dialog—a file need not belong to a solution to appear in the drop-down or dialog.
Visual C++ 6.0
You must save workspaces and enable "Watch for externally modified headers" in the options dialog of Visual Assist to keep the drop-down and dialog updated as files are added to, and removed from, projects. Without the setting, only files in a workspace when the workspace is opened appear in the drop-down and dialog.
Registry Settings
Value Name | Meaning |
---|---|
EnableFilterStartAndEndTokens | Set preference for start- and end-token filtering |
ProgramFilesDirsAreSystemIncludes | Disable designation of solution files in "\Program Files" as shared system |
SelectRecentItemsInNavigationDialogs | Force navigation features to select first alphabetical match |
ThirdPartyRegex | Designate 3rd-party source va regex |
UseGitRootForAugmentSolution | Prevent Open File in Solution (OFIS) from searching all files under control of a git repo |
Visual Studio Find File in Solution Explorer
Source: https://docs.wholetomato.com/default.asp?W193