Exemple #1
0
        private void AppendTypeElement([NotNull] ITypeElement typeElement, [NotNull] ISubstitution substitution, QualifierDisplays expectedQualifierDisplay, Context context)
        {
            if (!(typeElement is ITypeParameter) && (context.Options.ShowQualifiers & expectedQualifierDisplay) != QualifierDisplays.None)
            {
                AppendNamespace(typeElement.GetContainingNamespace());
                AppendText(".", VsHighlightingAttributeIds.Operator);

                ITypeElement containingType = typeElement.GetContainingType();
                if (containingType != null && !(typeElement is IDelegate && context.Options.FormatDelegatesAsLambdas))
                {
                    AppendDeclaredType(TypeFactory.CreateType(containingType, substitution), QualifierDisplays.None, context);
                    AppendText(".", VsHighlightingAttributeIds.Operator);
                }
            }

            var deleg = typeElement as IDelegate;

            if (deleg != null && context.Options.FormatDelegatesAsLambdas && expectedQualifierDisplay == QualifierDisplays.Parameters)
            {
                AppendParameters(deleg.InvokeMethod, substitution, false, context);
                AppendText(" => ", VsHighlightingAttributeIds.Operator);
                AppendTypeWithoutModule(substitution.Apply(deleg.InvokeMethod.ReturnType), expectedQualifierDisplay, context);
                return;
            }

            string highlighterId = typeElement.GetHighlightingAttributeId(_useReSharperColors);

            AppendText(FormatShortName(typeElement.ShortName), highlighterId);
            AppendTypeParameters(typeElement, substitution, context);
        }