当前位置: 首页>>代码示例>>C#>>正文


C# ISymbol.GetDocumentationCommentXml方法代码示例

本文整理汇总了C#中ISymbol.GetDocumentationCommentXml方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.GetDocumentationCommentXml方法的具体用法?C# ISymbol.GetDocumentationCommentXml怎么用?C# ISymbol.GetDocumentationCommentXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISymbol的用法示例。


在下文中一共展示了ISymbol.GetDocumentationCommentXml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

		/// <summary>
		/// Gets the XML documentation element for the specified entity.
		/// Returns null if no documentation is found.
		/// </summary>
        public static XmlDocumentationElement Get(ISymbol entity, bool inheritDocIfMissing = true)
		{
			if (entity == null)
				return null;
            var documentationComment = entity.GetDocumentationCommentXml();
			if (documentationComment != null) {
				return Create(documentationComment, entity);
			}
			
            var member = entity as ISymbol;
			if (inheritDocIfMissing && member != null) {
                var method = member as IMethodSymbol;
                if (method != null && method.MethodKind == MethodKind.Constructor) {
					// For constructors, the documentation of the base class ctor
					// isn't really suitable as constructors are not inherited.
					// We'll use the type's documentation instead:
                    return Get(entity.ContainingType, inheritDocIfMissing);
				}
                // TODO
//            foreach (var baseMember in InheritanceHelper.GetBaseMembers(member, includeImplementedInterfaces: true)) {
//	documentationComment = baseMember.Documentation;
//	if (documentationComment != null)
//		return Create(documentationComment, baseMember);
//}
			}
			return null;
		}
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:31,代码来源:DocumentationElement.cs

示例2: ParseDocumentation

        public SDLanguageItemCollection<SDDocumentation> ParseDocumentation(ISymbol symbol)
        {
            var documentationXml = symbol.GetDocumentationCommentXml();
            var docDic = new SDLanguageItemCollection<SDDocumentation>();
            if (!string.IsNullOrEmpty(documentationXml))
            {
                var xml = XDocument.Parse($"<doc>{documentationXml}</doc>");
                foreach (var child in xml.Descendants())
                {
                    var isoCode = child.Name.LocalName.ToLower();
                    if (CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any(c => c.TwoLetterISOLanguageName == isoCode) || isoCode == "default")
                    {
                        // TODO
                        //_sdRepository.AddDocumentationLanguage(child.Name.ToLower());
                        var languageDoc = ParseDocumentation(child.Descendants(), true);
                        if(!docDic.ContainsKey(isoCode)) docDic.Add(isoCode, languageDoc);
                    }
                }

                //Es wurde keine Sprachunterstützung in der Doku genutzt.
                //Deswegen wird die Doku einfach als "default" geladen.
                if (docDic.Count == 0)
                {
                    var defaultDoc = ParseDocumentation(xml.Descendants());
                    docDic.Add("default", defaultDoc);
                }
            }
            return docDic;
        }
开发者ID:Geaz,项目名称:sharpDox,代码行数:29,代码来源:DocumentationParser.cs

示例3: AddXmlDocumentation

        private void AddXmlDocumentation(ISymbol symbol, MetadataItems metadata)
        {
            string documentationCommentXml = symbol.GetDocumentationCommentXml(expandIncludes: true);
            XmlDocumentationParser xmlDocumentationParser
                = new XmlDocumentationParser(symbol, _commentIdToDocument, _cssClasses, _context.Trace);
            IEnumerable<string> otherHtmlElementNames = xmlDocumentationParser.Parse(documentationCommentXml);

            // Add standard HTML elements
            metadata.AddRange(new []
            {
                new MetadataItem(CodeAnalysisKeys.CommentXml, documentationCommentXml),
                new MetadataItem(CodeAnalysisKeys.Example, (k, m) => xmlDocumentationParser.Process().Example),
                new MetadataItem(CodeAnalysisKeys.Remarks, (k, m) => xmlDocumentationParser.Process().Remarks),
                new MetadataItem(CodeAnalysisKeys.Summary, (k, m) => xmlDocumentationParser.Process().Summary),
                new MetadataItem(CodeAnalysisKeys.Returns, (k, m) => xmlDocumentationParser.Process().Returns),
                new MetadataItem(CodeAnalysisKeys.Value, (k, m) => xmlDocumentationParser.Process().Value),
                new MetadataItem(CodeAnalysisKeys.Exceptions, (k, m) => xmlDocumentationParser.Process().Exceptions),
                new MetadataItem(CodeAnalysisKeys.Permissions, (k, m) => xmlDocumentationParser.Process().Permissions),
                new MetadataItem(CodeAnalysisKeys.Params, (k, m) => xmlDocumentationParser.Process().Params),
                new MetadataItem(CodeAnalysisKeys.TypeParams, (k, m) => xmlDocumentationParser.Process().TypeParams),
                new MetadataItem(CodeAnalysisKeys.SeeAlso, (k, m) => xmlDocumentationParser.Process().SeeAlso)
            });

            // Add other HTML elements with keys of [ElementName]Html
            metadata.AddRange(otherHtmlElementNames.Select(x => 
                new MetadataItem(FirstLetterToUpper(x) + "Comments",
                    (k, m) => xmlDocumentationParser.Process().OtherComments[x])));
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:28,代码来源:AnalyzeSymbolVisitor.cs

示例4: MakeAutoCompleteResponse

        private AutoCompleteResponse MakeAutoCompleteResponse(AutoCompleteRequest request, ISymbol symbol, bool includeOptionalParams = true)
        {
            var displayNameGenerator = new SnippetGenerator();
            displayNameGenerator.IncludeMarkers = false;
            displayNameGenerator.IncludeOptionalParameters = includeOptionalParams;

            var response = new AutoCompleteResponse();
            response.CompletionText = symbol.Name;

            // TODO: Do something more intelligent here
            response.DisplayText = displayNameGenerator.Generate(symbol);

            if (request.WantDocumentationForEveryCompletionResult)
            {
                response.Description = DocumentationConverter.ConvertDocumentation(symbol.GetDocumentationCommentXml(), _options.FormattingOptions.NewLine);
            }

            if (request.WantReturnType)
            {
                response.ReturnType = ReturnTypeFormatter.GetReturnType(symbol);
            }

            if (request.WantKind)
            {
                response.Kind = symbol.GetKind();
            }

            if (request.WantSnippet)
            {
                var snippetGenerator = new SnippetGenerator();
                snippetGenerator.IncludeMarkers = true;
                snippetGenerator.IncludeOptionalParameters = includeOptionalParams;
                response.Snippet = snippetGenerator.Generate(symbol);
            }

            if (request.WantMethodHeader)
            {
                response.MethodHeader = displayNameGenerator.Generate(symbol);
            }

            return response;
        }
开发者ID:tugberkugurlu,项目名称:omnisharp-roslyn,代码行数:42,代码来源:OmnisharpController.Intellisense.cs

示例5: AddXmlDocumentation

        private void AddXmlDocumentation(ISymbol symbol, List<KeyValuePair<string, object>> metadata)
        {
            string documentationCommentXml = symbol.GetDocumentationCommentXml(expandIncludes: true);
            XmlDocumentationParser xmlDocumentationParser
                = new XmlDocumentationParser(symbol, _commentIdToDocument, _cssClasses, _context.Trace);
            IEnumerable<string> otherHtmlElementNames = xmlDocumentationParser.Parse(documentationCommentXml);

            // Add standard HTML elements
            metadata.AddRange(new []
            {
                Metadata.Create(MetadataKeys.DocumentationCommentXml, documentationCommentXml),
                Metadata.Create(MetadataKeys.ExampleHtml, (k, m) => xmlDocumentationParser.Process().ExampleHtml),
                Metadata.Create(MetadataKeys.RemarksHtml, (k, m) => xmlDocumentationParser.Process().RemarksHtml),
                Metadata.Create(MetadataKeys.SummaryHtml, (k, m) => xmlDocumentationParser.Process().SummaryHtml),
                Metadata.Create(MetadataKeys.ReturnsHtml, (k, m) => xmlDocumentationParser.Process().ReturnsHtml),
                Metadata.Create(MetadataKeys.ValueHtml, (k, m) => xmlDocumentationParser.Process().ValueHtml),
                Metadata.Create(MetadataKeys.ExceptionHtml, (k, m) => xmlDocumentationParser.Process().ExceptionHtml),
                Metadata.Create(MetadataKeys.PermissionHtml, (k, m) => xmlDocumentationParser.Process().PermissionHtml),
                Metadata.Create(MetadataKeys.ParamHtml, (k, m) => xmlDocumentationParser.Process().ParamHtml),
                Metadata.Create(MetadataKeys.TypeParamHtml, (k, m) => xmlDocumentationParser.Process().TypeParamHtml),
                Metadata.Create(MetadataKeys.SeeAlsoHtml, (k, m) => xmlDocumentationParser.Process().SeeAlsoHtml)
            });

            // Add other HTML elements with keys of [ElementName]Html
            metadata.AddRange(otherHtmlElementNames.Select(x =>
                Metadata.Create(FirstLetterToUpper(x) + "Html",
                    (k, m) => xmlDocumentationParser.Process().OtherHtml[x])));
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:28,代码来源:AnalyzeSymbolVisitor.cs

示例6: GetDocumentation

		public static string GetDocumentation (ISymbol member)
		{
			if (member == null)
				return null;
			var documentation = member.GetDocumentationCommentXml ();
			if (string.IsNullOrEmpty (documentation))
				documentation = MonoDocDocumentationProvider.GetDocumentation (member);
			if (documentation != null)
				return CleanEmpty (documentation);
			return null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:11,代码来源:Ambience.cs

示例7: BuildXmlDoc

        private static string BuildXmlDoc(ISymbol factoryMethod)
        {
            var documentationCommentXml = factoryMethod.GetDocumentationCommentXml();
            var relevantLines = documentationCommentXml.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                                                       .SkipWhile(line => !line.StartsWith(" "))
                                                       .TakeWhile(line => line != "</member>")
                                                       .ToArray();
            var indent = relevantLines.First().Length - relevantLines.First().TrimStart().Length;
            var relevantLinesAsXmlDoc = relevantLines.Select(line => "        /// {0}".FormatWith(line.Substring(indent)));

            return string.Join("\r\n", relevantLinesAsXmlDoc);
        }
开发者ID:romerod,项目名称:FactoryGenerator,代码行数:12,代码来源:MethodsBuilderService.cs

示例8: GetSummary

        private static string GetSummary(ISymbol symbol)
        {
            var summary = "";

            if (symbol != null)
            {
                var p = symbol as IPropertySymbol;
                if (p != null)
                {
                    summary = p.Type.ToDisplayString() + " " + p.Name;
                }
                else
                {
                    var m = symbol as IMethodSymbol;
                    if (m != null)
                    {
                        var prefix = m.IsExtensionMethod ? "(extension) " : "";
                        summary = string.Concat(prefix, m.ReturnType.ToDisplayString(), " ", m.ToDisplayString());
                    }
                    else
                    {
                        summary = symbol.ToDisplayString();
                    }
                }

                summary = summary.Replace("__Typewriter.", string.Empty);
                //summary = summary.Replace("__Code.", string.Empty);

                var documentation = symbol.GetDocumentationCommentXml();
                summary += ParseDocumentation(documentation);
            }

            return summary;
        }
开发者ID:ChinaJason,项目名称:Typewriter,代码行数:34,代码来源:Identifier.cs

示例9: MakeAutoCompleteResponse

        private AutoCompleteResponse MakeAutoCompleteResponse(AutoCompleteRequest request, ISymbol symbol, bool includeOptionalParams = true)
        {
            var response = new AutoCompleteResponse();
            response.CompletionText = symbol.Name;

            // TODO: Do something more intelligent here
            response.DisplayText = symbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);

            if (request.WantDocumentationForEveryCompletionResult)
            {
                response.Description = symbol.GetDocumentationCommentXml();
            }

            if (request.WantReturnType)
            {
                response.ReturnType = ReturnTypeFormatter.GetReturnType(symbol);
            }

            if (request.WantKind)
            {
                response.Kind = Enum.GetName(symbol.Kind.GetType(), symbol.Kind);
            }

            if (request.WantSnippet)
            {
                var snippetGenerator = new SnippetGenerator();
                snippetGenerator.IncludeMarkers = true;
                snippetGenerator.IncludeOptionalParameters = includeOptionalParams;
                response.Snippet = snippetGenerator.GenerateSnippet(symbol);
            }

            if (request.WantMethodHeader)
            {
                var snippetGenerator = new SnippetGenerator();
                snippetGenerator.IncludeMarkers = false;
                snippetGenerator.IncludeOptionalParameters = includeOptionalParams;
                response.MethodHeader = snippetGenerator.GenerateSnippet(symbol);
            }

            return response;
        }
开发者ID:Jenkin0603,项目名称:myvim,代码行数:41,代码来源:OmnisharpController.Intellisense.cs


注:本文中的ISymbol.GetDocumentationCommentXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。