Пример #1
0
 public static void FeedComments(MetadataItem item)
 {
     if (string.IsNullOrEmpty(item.RawComment))
     {
         return;
     }
     item.Summary = TripleSlashCommentParser.GetSummary(item.RawComment, true);
 }
Пример #2
0
        public static ApiParameter GetParameterDescription(ISymbol symbol, MetadataItem item, bool isReturn, SymbolDisplayFormat displayFormat)
        {
            SourceDetail id  = null;
            string       raw = item.RawComment;
            // TODO: GetDocumentationCommentXml for parameters seems not accurate
            string name       = symbol.Name;
            var    paraSymbol = symbol as IParameterSymbol;

            if (paraSymbol != null)
            {
                // TODO: why BaseType?
                id = GetLinkDetail(paraSymbol.Type, displayFormat);
            }

            // when would it be type symbol?
            var typeSymbol = symbol as ITypeSymbol;

            if (typeSymbol != null)
            {
                Debug.Assert(typeSymbol != null, "Should be TypeSymbol");

                // TODO: check what name is
                // name = DescriptionConstants.ReturnName;
                id = GetLinkDetail(typeSymbol, displayFormat);
            }

            var propertySymbol = symbol as IPropertySymbol;

            if (propertySymbol != null)
            {
                // TODO: check what name is
                // name = DescriptionConstants.ReturnName;
                id = GetLinkDetail(propertySymbol.Type, displayFormat);
            }

            string comment = isReturn ? TripleSlashCommentParser.GetReturns(raw, true) :
                             TripleSlashCommentParser.GetParam(raw, name, true);

            return(new ApiParameter()
            {
                Name = name, Type = id, Description = comment
            });
        }