• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDocumentationCommentFormattingService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDocumentationCommentFormattingService的典型用法代码示例。如果您正苦于以下问题:C# IDocumentationCommentFormattingService类的具体用法?C# IDocumentationCommentFormattingService怎么用?C# IDocumentationCommentFormattingService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDocumentationCommentFormattingService类属于命名空间,在下文中一共展示了IDocumentationCommentFormattingService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetDelegateInvokeItems

        private IEnumerable<SignatureHelpItem> GetDelegateInvokeItems(
            InvocationExpressionSyntax invocationExpression, SemanticModel semanticModel, ISymbolDisplayService symbolDisplayService, IAnonymousTypeDisplayService anonymousTypeDisplayService,
            IDocumentationCommentFormattingService documentationCommentFormattingService, ISymbol within, INamedTypeSymbol delegateType, CancellationToken cancellationToken)
        {
            var invokeMethod = delegateType.DelegateInvokeMethod;
            if (invokeMethod == null)
            {
                return null;
            }

            // Events can only be invoked directly from the class they were declared in.
            var expressionSymbol = semanticModel.GetSymbolInfo(invocationExpression.Expression, cancellationToken).GetAnySymbol();
            if (expressionSymbol.IsKind(SymbolKind.Event) &&
                !expressionSymbol.ContainingType.OriginalDefinition.Equals(within.OriginalDefinition))
            {
                return null;
            }

            var position = invocationExpression.SpanStart;
            var item = CreateItem(
                invokeMethod, semanticModel, position,
                symbolDisplayService, anonymousTypeDisplayService,
                isVariadic: invokeMethod.IsParams(),
                documentation: SpecializedCollections.EmptyEnumerable<SymbolDisplayPart>(),
                prefixParts: GetDelegateInvokePreambleParts(invokeMethod, semanticModel, position),
                separatorParts: GetSeparatorParts(),
                suffixParts: GetDelegateInvokePostambleParts(),
                parameters: GetDelegateInvokeParameters(invokeMethod, semanticModel, position, documentationCommentFormattingService, cancellationToken));

            return SpecializedCollections.SingletonEnumerable(item);
        }
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:31,代码来源:InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs


示例2: ConvertDocCommentsToRegularComments

        protected override async Task<Document> ConvertDocCommentsToRegularComments(Document document, IDocumentationCommentFormattingService docCommentFormattingService, CancellationToken cancellationToken)
        {
            var syntaxRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            var newSyntaxRoot = DocCommentConverter.ConvertToRegularComments(syntaxRoot, docCommentFormattingService, cancellationToken);

            return document.WithSyntaxRoot(newSyntaxRoot);
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:8,代码来源:CSharpMetadataAsSourceService.cs


示例3: GetMethodGroupItems

        private IEnumerable<SignatureHelpItem> GetMethodGroupItems(
            InvocationExpressionSyntax invocationExpression,
            SemanticModel semanticModel,
            ISymbolDisplayService symbolDisplayService,
            IAnonymousTypeDisplayService anonymousTypeDisplayService,
            IDocumentationCommentFormattingService documentationCommentFormattingService,
            ISymbol within,
            IEnumerable<IMethodSymbol> methodGroup,
            CancellationToken cancellationToken)
        {
            ITypeSymbol throughType = null;
            if (invocationExpression.Expression is MemberAccessExpressionSyntax)
            {
                var throughExpression = ((MemberAccessExpressionSyntax)invocationExpression.Expression).Expression;
                var throughSymbol = semanticModel.GetSymbolInfo(throughExpression, cancellationToken).GetAnySymbol();

                // if it is via a base expression "base.", we know the "throughType" is the base class but
                // we need to be able to tell between "base.M()" and "new Base().M()".
                // currently, Access check methods do not differentiate between them.
                // so handle "base." primary-expression here by nulling out "throughType"
                if (!(throughExpression is BaseExpressionSyntax))
                {
                    throughType = semanticModel.GetTypeInfo(throughExpression, cancellationToken).Type;
                }

                var includeInstance = !throughExpression.IsKind(SyntaxKind.IdentifierName) ||
                    semanticModel.LookupSymbols(throughExpression.SpanStart, name: throughSymbol.Name).Any(s => !(s is INamedTypeSymbol)) ||
                    (!(throughSymbol is INamespaceOrTypeSymbol) && semanticModel.LookupSymbols(throughExpression.SpanStart, container: throughSymbol.ContainingType).Any(s => !(s is INamedTypeSymbol)));

                var includeStatic = throughSymbol is INamedTypeSymbol ||
                    (throughExpression.IsKind(SyntaxKind.IdentifierName) &&
                    semanticModel.LookupNamespacesAndTypes(throughExpression.SpanStart, name: throughSymbol.Name).Any(t => t.GetSymbolType() == throughType));

                Contract.ThrowIfFalse(includeInstance || includeStatic);
                methodGroup = methodGroup.Where(m => (m.IsStatic && includeStatic) || (!m.IsStatic && includeInstance));
            }
            else if (invocationExpression.Expression is SimpleNameSyntax &&
                invocationExpression.IsInStaticContext())
            {
                methodGroup = methodGroup.Where(m => m.IsStatic);
            }

            var accessibleMethods = methodGroup.Where(m => m.IsAccessibleWithin(within, throughTypeOpt: throughType)).ToList();
            if (accessibleMethods.Count == 0)
            {
                return null;
            }

            var methodSet = accessibleMethods.ToSet();
            accessibleMethods = accessibleMethods.Where(m => !IsHiddenByOtherMethod(m, methodSet)).ToList();

            return accessibleMethods.Select(m =>
                ConvertMethodGroupMethod(m, invocationExpression, semanticModel, symbolDisplayService, anonymousTypeDisplayService, documentationCommentFormattingService, cancellationToken));
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:54,代码来源:InvocationExpressionSignatureHelpProvider_MethodGroup.cs


示例4: GetDelegateInvokeParameters

 private IEnumerable<SignatureHelpParameter> GetDelegateInvokeParameters(
     IMethodSymbol invokeMethod, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formattingService, CancellationToken cancellationToken)
 {
     foreach (var parameter in invokeMethod.Parameters)
     {
         yield return new SignatureHelpParameter(
             parameter.Name,
             parameter.IsOptional,
             parameter.GetDocumentationParts(semanticModel, position, formattingService, cancellationToken),
             parameter.ToMinimalDisplayParts(semanticModel, position));
     }
 }
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:12,代码来源:InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs


示例5: Convert

 protected static SignatureHelpParameter Convert(
     IParameterSymbol parameter,
     SemanticModel semanticModel,
     int position,
     IDocumentationCommentFormattingService formatter,
     CancellationToken cancellationToken)
 {
     return new SignatureHelpParameter(
         parameter.Name,
         parameter.IsOptional,
         parameter.GetDocumentationPartsFactory(semanticModel, position, formatter),
         parameter.ToMinimalDisplayParts(semanticModel, position));
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:13,代码来源:AbstractCSharpSignatureHelpProvider.cs


示例6: GetDelegateInvokeParameters

        private IList<SignatureHelpSymbolParameter> GetDelegateInvokeParameters(
            IMethodSymbol invokeMethod, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formattingService, CancellationToken cancellationToken)
        {
            var result = new List<SignatureHelpSymbolParameter>();

            foreach (var parameter in invokeMethod.Parameters)
            {
                cancellationToken.ThrowIfCancellationRequested();
                result.Add(new SignatureHelpSymbolParameter(
                    parameter.Name,
                    parameter.IsOptional,
                    parameter.GetDocumentationPartsFactory(semanticModel, position, formattingService),
                    parameter.ToMinimalDisplayParts(semanticModel, position)));
            }

            return result;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs


示例7: GetNormalTypeConstructors

        private IList<SignatureHelpItem> GetNormalTypeConstructors(
            Document document,
            ObjectCreationExpressionSyntax objectCreationExpression,
            SemanticModel semanticModel,
            ISymbolDisplayService symbolDisplayService,
            IAnonymousTypeDisplayService anonymousTypeDisplayService,
            IDocumentationCommentFormattingService documentationCommentFormattingService,
            INamedTypeSymbol normalType,
            ISymbol within,
            CancellationToken cancellationToken)
        {
            var accessibleConstructors = normalType.InstanceConstructors
                                                   .Where(c => c.IsAccessibleWithin(within))
                                                   .Where(s => s.IsEditorBrowsable(document.ShouldHideAdvancedMembers(), semanticModel.Compilation))
                                                   .Sort(symbolDisplayService, semanticModel, objectCreationExpression.SpanStart);

            return accessibleConstructors.Select(c =>
                ConvertNormalTypeConstructor(c, objectCreationExpression, semanticModel, symbolDisplayService, anonymousTypeDisplayService, documentationCommentFormattingService, cancellationToken)).ToList();
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:19,代码来源:ObjectCreationExpressionSignatureHelpProvider_NormalType.cs


示例8: WrappedNamedTypeSymbol

            public WrappedNamedTypeSymbol(INamedTypeSymbol symbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService)
                : base(symbol, canImplementImplicitly, docCommentFormattingService)
            {
                _symbol = symbol;

                var allMembers = _symbol.GetMembers();
                var filteredMembers = from m in allMembers
                                      where !m.HasUnsupportedMetadata
                                      where m.DeclaredAccessibility == Accessibility.Public ||
                                            m.DeclaredAccessibility == Accessibility.Protected ||
                                            m.DeclaredAccessibility == Accessibility.ProtectedOrInternal
                                      where m.Kind == SymbolKind.Event ||
                                            m.Kind == SymbolKind.Field ||
                                            m.Kind == SymbolKind.Method ||
                                            m.Kind == SymbolKind.NamedType ||
                                            m.Kind == SymbolKind.Property
                                      select WrapMember(m, canImplementImplicitly, docCommentFormattingService);

                _members = ImmutableArray.CreateRange<ISymbol>(filteredMembers);
            }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:20,代码来源:AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs


示例9: ConvertNormalTypeConstructor

        private SignatureHelpItem ConvertNormalTypeConstructor(
            IMethodSymbol constructor,
            ObjectCreationExpressionSyntax objectCreationExpression,
            SemanticModel semanticModel,
            ISymbolDisplayService symbolDisplayService,
            IAnonymousTypeDisplayService anonymousTypeDisplayService,
            IDocumentationCommentFormattingService documentationCommentFormattingService,
            CancellationToken cancellationToken)
        {
            var position = objectCreationExpression.SpanStart;
            var item = CreateItem(
                constructor, semanticModel, position,
                symbolDisplayService, anonymousTypeDisplayService,
                constructor.IsParams(),
                constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
                GetNormalTypePreambleParts(constructor, semanticModel, position),
                GetSeparatorParts(),
                GetNormalTypePostambleParts(constructor),
                constructor.Parameters.Select(p => Convert(p, semanticModel, position, documentationCommentFormattingService, cancellationToken)));

            return item;
        }
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:22,代码来源:ObjectCreationExpressionSignatureHelpProvider_NormalType.cs


示例10: WrapMember

            private static ISymbol WrapMember(ISymbol m, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService)
            {
                switch (m.Kind)
                {
                    case SymbolKind.Field:
                        return new WrappedFieldSymbol((IFieldSymbol)m, docCommentFormattingService);

                    case SymbolKind.Event:
                        return new WrappedEventSymbol((IEventSymbol)m, canImplementImplicitly, docCommentFormattingService);

                    case SymbolKind.Method:
                        return new WrappedMethodSymbol((IMethodSymbol)m, canImplementImplicitly, docCommentFormattingService);

                    case SymbolKind.NamedType:
                        return new WrappedNamedTypeSymbol((INamedTypeSymbol)m, canImplementImplicitly, docCommentFormattingService);

                    case SymbolKind.Property:
                        return new WrappedPropertySymbol((IPropertySymbol)m, canImplementImplicitly, docCommentFormattingService);
                }

                throw ExceptionUtilities.Unreachable;
            }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:22,代码来源:AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs


示例11: Convert

 private SignatureHelpSymbolParameter Convert(
     ITypeParameterSymbol parameter,
     SemanticModel semanticModel,
     int position,
     IDocumentationCommentFormattingService formatter,
     CancellationToken cancellationToken)
 {
     return new SignatureHelpSymbolParameter(
         parameter.Name,
         isOptional: false,
         documentationFactory: parameter.GetDocumentationPartsFactory(semanticModel, position, formatter),
         displayParts: parameter.ToMinimalDisplayParts(semanticModel, position, s_minimallyQualifiedFormat),
         selectedDisplayParts: GetSelectedDisplayParts(parameter, semanticModel, position, cancellationToken));
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:14,代码来源:GenericNameSignatureHelpProvider.cs


示例12: GetDocumentationParts

        public static IEnumerable<TaggedText> GetDocumentationParts(this ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter, CancellationToken cancellationToken)
        {
            string documentation = GetDocumentation(symbol, cancellationToken);

            return documentation != null
                ? formatter.Format(documentation, semanticModel, position, CrefFormat)
                : SpecializedCollections.EmptyEnumerable<TaggedText>();
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:8,代码来源:ISymbolExtensions_2.cs


示例13: ConvertMethodGroupMethod

 private SignatureHelpItem ConvertMethodGroupMethod(
     IMethodSymbol method,
     InvocationExpressionSyntax invocationExpression,
     SemanticModel semanticModel,
     ISymbolDisplayService symbolDisplayService,
     IAnonymousTypeDisplayService anonymousTypeDisplayService,
     IDocumentationCommentFormattingService documentationCommentFormattingService,
     CancellationToken cancellationToken)
 {
     var position = invocationExpression.SpanStart;
     var item = CreateItem(
         method, semanticModel, position,
         symbolDisplayService, anonymousTypeDisplayService,
         method.IsParams(),
         c => method.OriginalDefinition.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, c).Concat(GetAwaitableUsage(method, semanticModel, position)),
         GetMethodGroupPreambleParts(method, semanticModel, position),
         GetSeparatorParts(),
         GetMethodGroupPostambleParts(method),
         method.Parameters.Select(p => Convert(p, semanticModel, position, documentationCommentFormattingService, cancellationToken)));
     return item;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:21,代码来源:InvocationExpressionSignatureHelpProvider_MethodGroup.cs


示例14: DocCommentConverter

 private DocCommentConverter(IDocumentationCommentFormattingService formattingService, CancellationToken cancellationToken)
     : base(visitIntoStructuredTrivia: false)
 {
     _formattingService = formattingService;
     _cancellationToken = cancellationToken;
 }
开发者ID:noahfalk,项目名称:roslyn,代码行数:6,代码来源:CSharpMetadataAsSourceService.cs


示例15: GetDocumentationPartsFactory

 public static Func<CancellationToken, IEnumerable<SymbolDisplayPart>> GetDocumentationPartsFactory(this ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter)
 {
     return c => symbol.GetDocumentationParts(semanticModel, position, formatter, cancellationToken: c);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:4,代码来源:ISymbolExtensions_2.cs


示例16: AddDocumentationPart

        private static void AddDocumentationPart(List<SymbolDisplayPart> textContentBuilder, ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter, CancellationToken cancellationToken)
        {
            var documentation = symbol.GetDocumentationParts(semanticModel, position, formatter, cancellationToken);

            if (documentation.Any())
            {
                textContentBuilder.AddLineBreak();
                textContentBuilder.AddRange(documentation);
            }
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:10,代码来源:CommonCompletionUtilities.cs


示例17: ConvertDocCommentsToRegularComments

 protected abstract Task<Document> ConvertDocCommentsToRegularComments(Document document, IDocumentationCommentFormattingService docCommentFormattingService, CancellationToken cancellationToken);
开发者ID:nemec,项目名称:roslyn,代码行数:1,代码来源:AbstractMetadataAsSourceService.cs


示例18: WrappedMethodSymbol

 public WrappedMethodSymbol(IMethodSymbol methodSymbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService)
     : base(methodSymbol, canImplementImplicitly, docCommentFormattingService)
 {
     _symbol = methodSymbol;
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:5,代码来源:AbstractMetadataAsSourceService.WrappedMethodSymbol.cs


示例19: WrappedFieldSymbol

 public WrappedFieldSymbol(IFieldSymbol fieldSymbol, IDocumentationCommentFormattingService docCommentFormattingService)
     : base(fieldSymbol, canImplementImplicitly: false, docCommentFormattingService: docCommentFormattingService)
 {
     _symbol = fieldSymbol;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:5,代码来源:AbstractMetadataAsSourceService.WrappedFieldSymbol.cs


示例20: GetDocumentationContent

        private IDeferredQuickInfoContent GetDocumentationContent(
            IEnumerable<ISymbol> symbols,
            IDictionary<SymbolDescriptionGroups, ImmutableArray<TaggedText>> sections,
            SemanticModel semanticModel,
            SyntaxToken token,
            IDocumentationCommentFormattingService formatter,
            ISyntaxFactsService syntaxFactsService,
            CancellationToken cancellationToken)
        {
            if (sections.ContainsKey(SymbolDescriptionGroups.Documentation))
            {
                var documentationBuilder = new List<TaggedText>();
                documentationBuilder.AddRange(sections[SymbolDescriptionGroups.Documentation]);
                return CreateClassifiableDeferredContent(documentationBuilder);
            }
            else if (symbols.Any())
            {
                var symbol = symbols.First().OriginalDefinition;

                // if generating quick info for an attribute, bind to the class instead of the constructor
                if (syntaxFactsService.IsAttributeName(token.Parent) &&
                    symbol.ContainingType?.IsAttribute() == true)
                {
                    symbol = symbol.ContainingType;
                }

                var documentation = symbol.GetDocumentationParts(semanticModel, token.SpanStart, formatter, cancellationToken);

                if (documentation != null)
                {
                    return CreateClassifiableDeferredContent(documentation.ToList());
                }
            }

            return CreateDocumentationCommentDeferredContent(null);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:36,代码来源:AbstractSemanticQuickInfoProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDocumentationProvider类代码示例发布时间:2022-05-24
下一篇:
C# IDocumentStore类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap