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


C# IDocumentationCommentFormattingService类代码示例

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


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


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