public AnonymousTypeDisplayInfo GetNormalAnonymousTypeDisplayInfo(
            ISymbol orderSymbol,
            IEnumerable <INamedTypeSymbol> directNormalAnonymousTypeReferences,
            SemanticModel semanticModel,
            int position,
            ISymbolDisplayService displayService)
        {
            if (!directNormalAnonymousTypeReferences.Any())
            {
                return(new AnonymousTypeDisplayInfo(
                           SpecializedCollections.EmptyDictionary <INamedTypeSymbol, string>(),
                           SpecializedCollections.EmptyList <SymbolDisplayPart>()));
            }

            var transitiveNormalAnonymousTypeReferences = GetTransitiveNormalAnonymousTypeReferences(directNormalAnonymousTypeReferences.ToSet());

            transitiveNormalAnonymousTypeReferences = OrderAnonymousTypes(transitiveNormalAnonymousTypeReferences, orderSymbol);

            IList <SymbolDisplayPart> anonymousTypeParts = new List <SymbolDisplayPart>();

            anonymousTypeParts.Add(PlainText(FeaturesResources.Anonymous_Types_colon));
            anonymousTypeParts.AddRange(LineBreak());

            for (int i = 0; i < transitiveNormalAnonymousTypeReferences.Count; i++)
            {
                if (i != 0)
                {
                    anonymousTypeParts.AddRange(LineBreak());
                }

                var anonymousType = transitiveNormalAnonymousTypeReferences[i];
                anonymousTypeParts.AddRange(Space(count: 4));
                anonymousTypeParts.Add(Part(SymbolDisplayPartKind.ClassName, anonymousType, anonymousType.Name));
                anonymousTypeParts.AddRange(Space());
                anonymousTypeParts.Add(PlainText(FeaturesResources.is_));
                anonymousTypeParts.AddRange(Space());
                anonymousTypeParts.AddRange(GetAnonymousTypeParts(anonymousType, semanticModel, position, displayService));
            }

            // Now, inline any delegate anonymous types we've got.
            anonymousTypeParts = this.InlineDelegateAnonymousTypes(anonymousTypeParts, semanticModel, position, displayService);

            // Finally, assign a name to all the anonymous types.
            var anonymousTypeToName = GenerateAnonymousTypeNames(transitiveNormalAnonymousTypeReferences);

            anonymousTypeParts = AnonymousTypeDisplayInfo.ReplaceAnonymousTypes(anonymousTypeParts, anonymousTypeToName);

            return(new AnonymousTypeDisplayInfo(anonymousTypeToName, anonymousTypeParts));
        }
 private SignatureHelpParameter ReplaceAnonymousTypes(
     SignatureHelpParameter parameter,
     AnonymousTypeDisplayInfo info)
 {
     return new SignatureHelpParameter(
         parameter.Name,
         parameter.IsOptional,
         parameter.DocumentationFactory,
         info.ReplaceAnonymousTypes(parameter.DisplayParts),
         info.ReplaceAnonymousTypes(parameter.SelectedDisplayParts));
 }