Skip to content

Commit

Permalink
- Don't list C++ project files in the dialog.
Browse files Browse the repository at this point in the history
- Restored code to not list virtual folders as their own items. These are for filters and such that don't correlate to an actual on-disk object that can be opened.
- Fixed a null object dereference error that could pop up for certain solution configurations.
  • Loading branch information
parnic committed Jul 26, 2015
1 parent a8cf4cf commit 45a28ad
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions OpenFileInSolutionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public sealed class OpenFileInSolutionPackage : Package
static readonly Guid ProjectFileGuid = new Guid("6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C");
static readonly Guid ProjectFolderGuid = new Guid("6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C");
static readonly Guid ProjectVirtualFolderGuid = new Guid("6BB5F8F0-4483-11D3-8BCF-00C04F8EC28C");
static readonly List<string> FileEndingsToSkip = new List<string>()
{
".vcxproj.filters",
".vcxproj"
};

/// <summary>
/// Default constructor of the package.
Expand Down Expand Up @@ -148,27 +153,43 @@ private static IEnumerable<Project> GetSolutionFolderProjects(Project solutionFo

private IEnumerable<ProjectItemWrapper> EnumerateProjectItems(ProjectItems items)
{
for (int i = 1; i <= items.Count; i++)
if (items != null)
{
var itm = items.Item(i);
if (Guid.Parse(itm.Kind).Equals(ProjectFolderGuid))
for (int i = 1; i <= items.Count; i++)
{
continue;
}
var itm = items.Item(i);
var itmGuid = Guid.Parse(itm.Kind);
if (itmGuid.Equals(ProjectFolderGuid))
{
continue;
}

//if (Guid.Parse(itm.Kind).Equals(ProjectVirtualFolderGuid))
{
foreach (var res in EnumerateProjectItems(itm.ProjectItems))
{
yield return res;
}
}
//else
{
//Debug.WriteLine(itm.Kind + " - " + itm.FileCount + " - " + itm.FileNames[0]);

if (itmGuid.Equals(ProjectVirtualFolderGuid))
{
continue;
}

for (short j = 0; itm != null && j < itm.FileCount; j++)
{
yield return new ProjectItemWrapper(itm);
bool bSkip = false;
foreach (var ending in FileEndingsToSkip)
{
if (itm.FileNames[1].EndsWith(ending))
{
bSkip = true;
break;
}
}

if (!bSkip)
{
yield return new ProjectItemWrapper(itm);
}
}
}
}
Expand Down

0 comments on commit 45a28ad

Please sign in to comment.