Skip to content

Commit

Permalink
Merge pull request #19450 from tmeschter/FilterProjects
Browse files Browse the repository at this point in the history
Filter projects based on language name
  • Loading branch information
tmeschter authored May 12, 2017
2 parents 2ea8ebb + f67c247 commit 89d6bba
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
{
Expand Down Expand Up @@ -47,6 +46,16 @@ public bool TryGetProjectId(IVsHierarchyItem hierarchyItem, string targetFramewo
var project = _workspace.DeferredState.ProjectTracker.ImmutableProjects
.Where(p =>
{
// We're about to access various properties of the IVsHierarchy associated with the project.
// The properties supported and the interpretation of their values varies from one project system
// to another. This code is designed with C# and VB in mind, so we need to filter out everything
// else.
if (p.Language != LanguageNames.CSharp
&& p.Language != LanguageNames.VisualBasic)
{
return false;
}

// Here we try to match the hierarchy from Solution Explorer to a hierarchy from the Roslyn project.
// The canonical name of a hierarchy item must be unique _within_ an hierarchy, but since we're
// examining multiple hierarchies the canonical name could be the same. Indeed this happens when two
Expand Down

0 comments on commit 89d6bba

Please sign in to comment.