Exemple #1
0
        private IdentifierTooltipContent TryPresentNonColorized(
            [CanBeNull] IHighlighter highlighter,
            [CanBeNull] IDeclaredElement element,
            [NotNull] IContextBoundSettingsStore settings)
        {
            RichTextBlock richTextToolTip = highlighter?.RichTextToolTip;

            if (richTextToolTip == null)
            {
                return(null);
            }

            RichText richText = richTextToolTip.RichText;

            if (richText.IsNullOrEmpty())
            {
                return(null);
            }

            var identifierContent = new IdentifierTooltipContent(richText, highlighter.Range);

            if (element != null && settings.GetValue((IdentifierTooltipSettings s) => s.ShowIcon))
            {
                identifierContent.Icon = TryGetIcon(element);
            }
            return(identifierContent);
        }
Exemple #2
0
        private static ExceptionContent TryExtractException(
            [CanBeNull] XmlElement exceptionElement,
            [NotNull] PsiLanguageType languageType,
            [NotNull] IPsiModule psiModule)
        {
            string cref = exceptionElement?.GetAttribute("cref");

            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            cref = XmlDocPresenterUtil.ProcessCref(cref);
            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            var exceptionContent = new ExceptionContent(cref);

            if (exceptionElement.HasChildNodes)
            {
                RichText richText = XmlDocRichTextPresenter.Run(exceptionElement, false, languageType, psiModule).RichText;
                if (!richText.IsNullOrEmpty())
                {
                    exceptionContent.Description = richText;
                }
            }
            return(exceptionContent);
        }
Exemple #3
0
        private static IssueTooltipContent TryCreateIssueContent([NotNull] IHighlighting highlighting, TextRange trackingRange,
                                                                 [CanBeNull] RichTextBlock textBlock, Severity severity, [NotNull] IContextBoundSettingsStore settings, [CanBeNull] ISolution solution)
        {
            if (textBlock == null || !severity.IsIssue())
            {
                return(null);
            }

            RichText text = textBlock.RichText;

            if (text.IsEmpty)
            {
                return(null);
            }

            if (settings.GetValue((IssueTooltipSettings s) => s.ColorizeElementsInErrors))
            {
                RichText enhancedText = TryEnhanceHighlighting(highlighting, settings, solution);
                if (!enhancedText.IsNullOrEmpty())
                {
                    text = enhancedText;
                }
            }

            var issueContent = new IssueTooltipContent(text, trackingRange);

            if (settings.GetValue((IssueTooltipSettings s) => s.ShowIcon))
            {
                issueContent.Icon = severity.TryGetIcon();
            }
            return(issueContent);
        }