Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exceptions from implementations of ProjectItem #4

Merged
merged 2 commits into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions OpenFileInSolutionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public OpenFileInSolutionPackage()
/// </summary>
protected override void Initialize()
{
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();

OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
Expand Down Expand Up @@ -180,17 +180,24 @@ private IEnumerable<ProjectItemWrapper> EnumerateProjectItems(ProjectItems items
for (int i = 1; i <= items.Count; i++)
{
var itm = items.Item(i);
var itmGuid = Guid.Parse(itm.Kind);


foreach (var res in EnumerateProjectItems(itm.ProjectItems))
{
yield return res;
}

if (itmGuid.Equals(ProjectVirtualFolderGuid)
|| itmGuid.Equals(ProjectFolderGuid))
try
{
var itmGuid = Guid.Parse(itm.Kind);
if (itmGuid.Equals(ProjectVirtualFolderGuid)
|| itmGuid.Equals(ProjectFolderGuid))
{
continue;
}
}
catch (Exception)
{
continue;
// itm.Kind may throw an exception with certain node types like WixExtension (COMException)
}

for (short j = 0; itm != null && j < itm.FileCount; j++)
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
VSQuickOpenFile
===============
# VSQuickOpenFile

Quickly display a list of files in your solution for opening. Supports searching by filename or path. Functions just like `Shift`+`Alt`+`O` in Visual Assist.

![Quick Open File](openfileinsolution.png?raw=true "Quick Open File")

This extension will parse the projects in your solution and look for files. Once it has built a list of these files, it allows you to search through them for the file you want to open and open it quickly. It supports searching for pieces of the filename in any order and can easily highlight multiple files with just the keyboard to open all at once.

## Usage
- Use the "Open File In Solution" entry at the top of the Tools menu.
- Set a key binding for Tools.OpenFileInSolution

## Installation
[Download](https://marketplace.visualstudio.com/items?itemName=PerniciousGames.OpenFileInSolution) this extension from the Visual Studio Marketplace.

## Future improvements:
- Need to cache the list of files in the solution so it doesn't have to re-parse them every time. This means updating the cached list when new files/projects are added or loaded.
- More options for controlling how files are listed and searched, such as the ability to only search through open files.