public override string ToString()
 {
     using (ReadLockCookie.Create())
     {
         using (CompilationContextCookie.GetExplicitUniversalContextIfNotSet())
         {
             var declaredElement = DeclaredElementPointer.FindDeclaredElement();
             if (declaredElement == null)
             {
                 return("Invalid");
             }
             return(DeclaredElementMenuItemFormatter.FormatText(declaredElement, declaredElement.PresentationLanguage, out _).Text);
         }
     }
 }
        public override RichText GetDisplayText()
        {
            var declaredElement = DeclaredElementPointer.FindDeclaredElement();

            if (declaredElement == null)
            {
                return("");
            }

            var elementRichText = DeclaredElementMenuItemFormatter.FormatText(declaredElement, declaredElement.PresentationLanguage, out _);
            var grayTextStyle   = TextStyle.FromForeColor(SystemColors.GrayText);
            var containerText   = DeclaredElementPresenter.Format(declaredElement.PresentationLanguage,
                                                                  DeclaredElementMenuItemFormatter.ContainerPresentationStyle, declaredElement, EmptySubstitution.INSTANCE).Text;

            var richText = new RichText(containerText, grayTextStyle);

            return(elementRichText + " " + richText + ", " + base.GetDisplayText());
        }
        public override string ToString()
        {
            var pointer = DeclaredElementPointer;

            if (pointer is null)
            {
                return("Invalid");
            }
            using (ReadLockCookie.Create())
            {
                using (CompilationContextCookie.GetExplicitUniversalContextIfNotSet())
                {
                    var element = pointer.FindDeclaredElement();
                    if (element == null)
                    {
                        return("Invalid");
                    }
                    var language = element.PresentationLanguage;
                    return(DeclaredElementMenuItemFormatter.FormatText(element, language, out _)?.Text ?? "Invalid");
                }
            }
        }