private ArgumentRoleTooltipContent TryGetArgumentRoleContent([NotNull] ITreeNode node, [NotNull] IContextBoundSettingsStore settings)
        {
            if (!settings.GetValue((IdentifierTooltipSettings s) => s.ShowArgumentsRole))
            {
                return(null);
            }

            var argument = node.GetContainingNode <IArgument>();
            DeclaredElementInstance <IParameter> parameterInstance = argument?.MatchingParameter;

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

            IParameter       parameter       = parameterInstance.Element;
            IParametersOwner parametersOwner = parameter.ContainingParametersOwner;

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

            HighlighterIdProvider highlighterIdProvider = _highlighterIdProviderFactory.CreateProvider(settings);

            RichText final = new RichText("Argument of ", TextStyle.Default);

            final.Append(_colorizerPresenter.TryPresent(
                             new DeclaredElementInstance(parametersOwner, parameterInstance.Substitution),
                             PresenterOptions.ForArgumentRoleParametersOwnerToolTip(settings),
                             argument.Language,
                             highlighterIdProvider));
            final.Append(": ", TextStyle.Default);
            final.Append(_colorizerPresenter.TryPresent(
                             parameterInstance,
                             PresenterOptions.ForArgumentRoleParameterToolTip(settings),
                             argument.Language,
                             highlighterIdProvider));

            var content = new ArgumentRoleTooltipContent(final, argument.GetDocumentRange().TextRange)
            {
                Description = TryGetDescription(parameter, parameter.Module, argument.Language, DeclaredElementDescriptionStyle.NO_OBSOLETE_SUMMARY_STYLE)
            };

            if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowIcon))
            {
                content.Icon = PsiSymbolsThemedIcons.Parameter.Id;
            }

            return(content);
        }
コード例 #2
0
 public void AddArgumentRoleTooltipContent([NotNull] ArgumentRoleTooltipContent content)
 => _argumentRoleContents.Add(content);