string GetMethodMarkup (IMethodSymbol method)
{
if (method == null)
throw new ArgumentNullException ("method");
var result = new StringBuilder ();
AppendModifiers (result, method);
result.Append (GetTypeReferenceString (method.ReturnType));
if (BreakLineAfterReturnType) {
result.AppendLine ();
} else {
result.Append (" ");
}
AppendExplicitInterfaces (result, method.ExplicitInterfaceImplementations.Cast<ISymbol> ());
if (method.MethodKind == MethodKind.BuiltinOperator || method.MethodKind == MethodKind.UserDefinedOperator) {
result.Append ("operator ");
result.Append (CSharpAmbience.GetOperator (method.Name));
} else {
result.Append (HighlightSemantically (FilterEntityName (method.Name), colorStyle.UserMethodDeclaration));
}
if (method.TypeArguments.Length > 0) {
result.Append ("<");
for (int i = 0; i < method.TypeArguments.Length; i++) {
if (i > 0)
result.Append (", ");
result.Append (HighlightSemantically (GetTypeReferenceString (method.TypeArguments [i], false), colorStyle.UserTypes));
}
result.Append (">");
} else {
AppendTypeParameters (result, method.TypeParameters);
}
// TODO!
// if (formattingOptions.SpaceBeforeMethodDeclarationParentheses)
// result.Append (" ");
result.Append ('(');
var parameters = method.Parameters;
AppendParameterList (result, parameters,
false /* formattingOptions.SpaceBeforeMethodDeclarationParameterComma*/,
false /* formattingOptions.SpaceAfterMethodDeclarationParameterComma*/);
result.Append (')');
return result.ToString ();
}