public string GetTypeReferenceString (IType type, bool highlight = true) { if (type == null) throw new ArgumentNullException ("type"); if (type.Kind == TypeKind.Null) return "?"; if (type.Kind == TypeKind.Array) { var arrayType = (ArrayType)type; return GetTypeReferenceString (arrayType.ElementType, highlight) + "[" + new string (',', arrayType.Dimensions - 1) + "]"; } if (type.Kind == TypeKind.Pointer) return GetTypeReferenceString (((PointerType)type).ElementType, highlight) + "*"; AstType astType; try { astType = astBuilder.ConvertType (type); } catch (Exception e) { var compilation = GetCompilation (type); if (compilation == null) { Console.WriteLine ("type:"+type.GetType ()); Console.WriteLine ("got exception while conversion:" + e); return "?"; } astType = new TypeSystemAstBuilder (new CSharpResolver (compilation)).ConvertType (type); } if (astType is PrimitiveType) { return Highlight (astType.ToString (formattingOptions), colorStyle.KeywordTypes); } var text = AmbienceService.EscapeText (astType.ToString (formattingOptions)); return highlight ? HighlightSemantically (text, colorStyle.UserTypes) : text; }