internal IVsNavInfo GetProjectNavInfo(Project project) { return new NavInfo( this.LibraryGuid, this.SymbolToolLanguage, project.GetProjectNavInfoName()); }
private IVsNavInfo CreateNavInfo( IAssemblySymbol containingAssembly, Project project, Compilation compilation, bool useExpandedHierarchy, string namespaceName = null, string className = null, string memberName = null) { Debug.Assert(containingAssembly != null); Debug.Assert(compilation != null); var portableExecutableReference = compilation.GetMetadataReference(containingAssembly) as PortableExecutableReference; var assemblyName = portableExecutableReference != null ? portableExecutableReference.FilePath : containingAssembly.Identity.Name; var isReferencedAssembly = !containingAssembly.Identity.Equals(compilation.Assembly.Identity); // useExpandedHierarchy is true when references are nested inside the project by the // hierarchy. In Class View, they are nested in the Project References node. In Object Browser, // they are not. // // In the case that references are nested inside of the project, we need to create the nav info // differently: // // project -> containing assembly -> namespace -> type // // Otherwise, we create it like so: // // containing assembly -> namespace -> type var libraryName = isReferencedAssembly ? assemblyName : project.GetProjectNavInfoName(); var metadataProjectItem = useExpandedHierarchy && isReferencedAssembly ? project.GetProjectNavInfoName() : null; return new NavInfo( this.LibraryGuid, this.SymbolToolLanguage, libraryName, metadataProjectItem, namespaceName, className, memberName); }