private void AppendName([NotNull] IDeclaredElement element) { string highlighterId = element.GetHighlightingAttributeId(_useReSharperColors); if (CSharpDeclaredElementUtil.IsDestructor(element)) { ITypeElement containingType = ((IClrDeclaredElement)element).GetContainingType(); if (containingType != null) { AppendText("~", VsHighlightingAttributeIds.Operator); AppendText(containingType.ShortName, highlighterId); return; } } if (CSharpDeclaredElementUtil.IsIndexer(element)) { AppendText("this", VsHighlightingAttributeIds.Keyword); return; } if (element is IAnonymousMethod) { AppendText("Anonymous method", highlighterId); return; } var conversionOperator = element as IConversionOperator; if (conversionOperator != null) { if (conversionOperator.IsImplicitCast) { AppendText("implicit", VsHighlightingAttributeIds.Keyword); } else if (conversionOperator.IsExplicitCast) { AppendText("explicit", VsHighlightingAttributeIds.Keyword); } return; } if (element is ISignOperator) { string signOperator = GetSignOperator(element.ShortName); if (!signOperator.IsEmpty()) { AppendText(signOperator, highlighterId); return; } } var ns = element as INamespace; if (ns != null && ns.IsRootNamespace) { AppendText("<Root Namespace>", highlighterId); return; } var parameter = element as IParameter; if (parameter != null && parameter.IsVarArg) { AppendText("__arglist", VsHighlightingAttributeIds.Keyword); return; } var constructor = element as IConstructor; if (constructor != null) { ITypeElement containingType = constructor.GetContainingType(); string shortName = containingType != null ? containingType.ShortName : constructor.ShortName; AppendText(FormatShortName(shortName), highlighterId); return; } AppendText(FormatShortName(element.ShortName), highlighterId); }