Skip to content

Commit

Permalink
Merge pull request #8045 from drewnoakes/fix-analyzer-child-nodes
Browse files Browse the repository at this point in the history
[17.2] Fix broken analyzer child nodes in Solution Explorer
  • Loading branch information
drewnoakes authored Apr 7, 2022
2 parents 5452635 + 740ad1a commit e9b5eab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ namespace Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Models
{
internal class AnalyzerDependencyModel : DependencyModel
{
// NOTE we include ProjectTreeFlags.FileSystemEntity here so that Roslyn can
// correctly identify the analyzer's path in order to attach child nodes to
// these dependency items in Solution Explorer. Without this flag, CPS will
// remove whatever file path we pass during tree construction (for performance
// reasons).

private static readonly DependencyFlagCache s_flagCache = new(
resolved: DependencyTreeFlags.AnalyzerDependency + DependencyTreeFlags.SupportsBrowse,
unresolved: DependencyTreeFlags.AnalyzerDependency + DependencyTreeFlags.SupportsBrowse);
resolved: DependencyTreeFlags.AnalyzerDependency + DependencyTreeFlags.SupportsBrowse + ProjectTreeFlags.FileSystemEntity,
unresolved: DependencyTreeFlags.AnalyzerDependency + DependencyTreeFlags.SupportsBrowse + ProjectTreeFlags.FileSystemEntity);

private static readonly DependencyIconSet s_iconSet = new(
icon: KnownMonikers.CodeInformation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void Resolved()
Assert.Equal(
DependencyTreeFlags.AnalyzerDependency +
DependencyTreeFlags.SupportsBrowse +
DependencyTreeFlags.ResolvedDependencyFlags,
DependencyTreeFlags.ResolvedDependencyFlags +
ProjectTreeFlags.FileSystemEntity,
model.Flags);
}

Expand Down Expand Up @@ -69,7 +70,8 @@ public void Unresolved()
Assert.Equal(
DependencyTreeFlags.AnalyzerDependency +
DependencyTreeFlags.SupportsBrowse +
DependencyTreeFlags.UnresolvedDependencyFlags,
DependencyTreeFlags.UnresolvedDependencyFlags +
ProjectTreeFlags.FileSystemEntity,
model.Flags);
}

Expand Down Expand Up @@ -102,7 +104,8 @@ public void Implicit()
DependencyTreeFlags.AnalyzerDependency +
DependencyTreeFlags.SupportsBrowse +
DependencyTreeFlags.ResolvedDependencyFlags -
DependencyTreeFlags.SupportsRemove,
DependencyTreeFlags.SupportsRemove +
ProjectTreeFlags.FileSystemEntity,
model.Flags);
}
}
Expand Down

0 comments on commit e9b5eab

Please sign in to comment.