Ejemplo n.º 1
0
 /// <summary>
 /// This version also accepts <see cref="SymbolDisplayCompilerInternalOptions"/>.
 /// </summary>
 internal SymbolDisplayFormat(
     SymbolDisplayCompilerInternalOptions compilerInternalOptions,
     SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle     = default(SymbolDisplayGlobalNamespaceStyle),
     SymbolDisplayTypeQualificationStyle typeQualificationStyle = default(SymbolDisplayTypeQualificationStyle),
     SymbolDisplayGenericsOptions genericsOptions           = default(SymbolDisplayGenericsOptions),
     SymbolDisplayMemberOptions memberOptions               = default(SymbolDisplayMemberOptions),
     SymbolDisplayParameterOptions parameterOptions         = default(SymbolDisplayParameterOptions),
     SymbolDisplayDelegateStyle delegateStyle               = default(SymbolDisplayDelegateStyle),
     SymbolDisplayExtensionMethodStyle extensionMethodStyle = default(SymbolDisplayExtensionMethodStyle),
     SymbolDisplayPropertyStyle propertyStyle               = default(SymbolDisplayPropertyStyle),
     SymbolDisplayLocalOptions localOptions = default(SymbolDisplayLocalOptions),
     SymbolDisplayKindOptions kindOptions   = default(SymbolDisplayKindOptions),
     SymbolDisplayMiscellaneousOptions miscellaneousOptions = default(SymbolDisplayMiscellaneousOptions))
 {
     this.GlobalNamespaceStyle    = globalNamespaceStyle;
     this.TypeQualificationStyle  = typeQualificationStyle;
     this.GenericsOptions         = genericsOptions;
     this.MemberOptions           = memberOptions;
     this.ParameterOptions        = parameterOptions;
     this.DelegateStyle           = delegateStyle;
     this.ExtensionMethodStyle    = extensionMethodStyle;
     this.PropertyStyle           = propertyStyle;
     this.LocalOptions            = localOptions;
     this.KindOptions             = kindOptions;
     this.MiscellaneousOptions    = miscellaneousOptions;
     this.CompilerInternalOptions = compilerInternalOptions;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a new instance of <see cref="SymbolDisplayFormat"/> accepting a variety of optional parameters.
 /// </summary>
 /// <param name="globalNamespaceStyle">
 /// The settings that determine how the global namespace is displayed.
 /// </param>
 /// <param name="typeQualificationStyle">
 /// The settings that determine how types are qualified (e.g. Nested vs Containing.Nested vs Namespace.Containing.Nested).
 /// </param>
 /// <param name="genericsOptions">
 /// The settings that determine how generics (on types and methods) should be described (i.e. the level of detail).
 /// </param>
 /// <param name="memberOptions">
 /// The settings that determine how fields, properties, events, and methods are displayed.
 /// </param>
 /// <param name="delegateStyle">
 /// The settings that determine how delegates are displayed (e.g. name vs full signature).
 /// </param>
 /// <param name="extensionMethodStyle">
 /// The settings that determine how extension methods are displayed.
 /// </param>
 /// <param name="parameterOptions">
 /// The settings that determine how parameters (of methods, properties/indexers, and delegates) are displayed.
 /// </param>
 /// <param name="propertyStyle">
 /// The settings that determine how properties are displayed.
 /// For example, "Prop" vs "Prop { get; set; }" in C# or "Prop" vs. "ReadOnly Prop" in Visual Basic.
 /// </param>
 /// <param name="localOptions">
 /// The settings that determine how local variables are displayed.
 /// </param>
 /// <param name="kindOptions">
 /// The settings that determine which kind keywords should be included when displaying symbols.
 /// </param>
 /// <param name="miscellaneousOptions">
 /// The settings that determine other characteristics of how symbols are displayed.
 /// </param>
 public SymbolDisplayFormat(
     SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle     = default(SymbolDisplayGlobalNamespaceStyle),
     SymbolDisplayTypeQualificationStyle typeQualificationStyle = default(SymbolDisplayTypeQualificationStyle),
     SymbolDisplayGenericsOptions genericsOptions           = default(SymbolDisplayGenericsOptions),
     SymbolDisplayMemberOptions memberOptions               = default(SymbolDisplayMemberOptions),
     SymbolDisplayDelegateStyle delegateStyle               = default(SymbolDisplayDelegateStyle),
     SymbolDisplayExtensionMethodStyle extensionMethodStyle = default(SymbolDisplayExtensionMethodStyle),
     SymbolDisplayParameterOptions parameterOptions         = default(SymbolDisplayParameterOptions),
     SymbolDisplayPropertyStyle propertyStyle               = default(SymbolDisplayPropertyStyle),
     SymbolDisplayLocalOptions localOptions = default(SymbolDisplayLocalOptions),
     SymbolDisplayKindOptions kindOptions   = default(SymbolDisplayKindOptions),
     SymbolDisplayMiscellaneousOptions miscellaneousOptions = default(SymbolDisplayMiscellaneousOptions))
     : this(
         compilerInternalOptions : default,
         globalNamespaceStyle,
         typeQualificationStyle,
         genericsOptions,
         memberOptions,
         parameterOptions,
         delegateStyle,
         extensionMethodStyle,
         propertyStyle,
         localOptions,
         kindOptions,
         miscellaneousOptions)
 {
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This version also accepts <see cref="SymbolDisplayCompilerInternalOptions"/>.
        /// </summary>
        internal SymbolDisplayFormat(
            SymbolDisplayCompilerInternalOptions compilerInternalOptions,
            SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle     = default(SymbolDisplayGlobalNamespaceStyle),
            SymbolDisplayTypeQualificationStyle typeQualificationStyle = default(SymbolDisplayTypeQualificationStyle),
            SymbolDisplayGenericsOptions genericsOptions           = default(SymbolDisplayGenericsOptions),
            SymbolDisplayMemberOptions memberOptions               = default(SymbolDisplayMemberOptions),
            SymbolDisplayParameterOptions parameterOptions         = default(SymbolDisplayParameterOptions),
            SymbolDisplayDelegateStyle delegateStyle               = default(SymbolDisplayDelegateStyle),
            SymbolDisplayExtensionMethodStyle extensionMethodStyle = default(SymbolDisplayExtensionMethodStyle),
            SymbolDisplayPropertyStyle propertyStyle               = default(SymbolDisplayPropertyStyle),
            SymbolDisplayLocalOptions localOptions = default(SymbolDisplayLocalOptions),
            SymbolDisplayKindOptions kindOptions   = default(SymbolDisplayKindOptions),
            SymbolDisplayMiscellaneousOptions miscellaneousOptions = default(SymbolDisplayMiscellaneousOptions))
        {
            // If we want to display `!`, then we surely also want to display `?`
            Debug.Assert(miscellaneousOptions.IncludesOption(SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier) ||
                         !compilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.IncludeNonNullableTypeModifier));

            this.GlobalNamespaceStyle    = globalNamespaceStyle;
            this.TypeQualificationStyle  = typeQualificationStyle;
            this.GenericsOptions         = genericsOptions;
            this.MemberOptions           = memberOptions;
            this.ParameterOptions        = parameterOptions;
            this.DelegateStyle           = delegateStyle;
            this.ExtensionMethodStyle    = extensionMethodStyle;
            this.PropertyStyle           = propertyStyle;
            this.LocalOptions            = localOptions;
            this.KindOptions             = kindOptions;
            this.MiscellaneousOptions    = miscellaneousOptions;
            this.CompilerInternalOptions = compilerInternalOptions;
        }
Ejemplo n.º 4
0
        public static string ToDocComment(this ISymbol symbol,
                                          SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle     = SymbolDisplayGlobalNamespaceStyle.Included,
                                          SymbolDisplayTypeQualificationStyle typeQualificationStyle = SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
                                          SymbolDisplayGenericsOptions genericsOptions           = SymbolDisplayGenericsOptions.IncludeTypeParameters,
                                          SymbolDisplayMemberOptions memberOptions               = SymbolDisplayMemberOptions.IncludeContainingType,
                                          SymbolDisplayDelegateStyle delegateStyle               = SymbolDisplayDelegateStyle.NameAndSignature,
                                          SymbolDisplayExtensionMethodStyle extensionMethodStyle = SymbolDisplayExtensionMethodStyle.StaticMethod,
                                          SymbolDisplayParameterOptions parameterOptions         = SymbolDisplayParameterOptions.IncludeType,
                                          SymbolDisplayPropertyStyle propertyStyle               = SymbolDisplayPropertyStyle.NameOnly,
                                          SymbolDisplayLocalOptions localOptions = SymbolDisplayLocalOptions.None,
                                          SymbolDisplayKindOptions kindOptions   = SymbolDisplayKindOptions.None,
                                          SymbolDisplayMiscellaneousOptions miscellaneousOptions = SymbolDisplayMiscellaneousOptions.ExpandNullable)
        {
            if (symbol == null)
            {
                return(string.Empty);
            }
            var fmt = symbol.ToDisplayString(new SymbolDisplayFormat(globalNamespaceStyle, typeQualificationStyle, genericsOptions, memberOptions, delegateStyle, extensionMethodStyle, parameterOptions, propertyStyle, localOptions, kindOptions, miscellaneousOptions));
            var sb  = new StringBuilder(fmt.Length);

            for (var i = 0; i < fmt.Length; i++)
            {
                var c = fmt[i];
                if (fmt[i] == '<')
                {
                    sb.Append('{');
                }
                else if (fmt[i] == '>')
                {
                    sb.Append('}');
                }
                else
                {
                    sb.Append(c);
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 5
0
 /// <summary>
 /// This version also accepts <see cref="SymbolDisplayCompilerInternalOptions"/>.
 /// </summary>
 internal SymbolDisplayFormat(
     SymbolDisplayCompilerInternalOptions compilerInternalOptions,
     SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle = default(SymbolDisplayGlobalNamespaceStyle),
     SymbolDisplayTypeQualificationStyle typeQualificationStyle = default(SymbolDisplayTypeQualificationStyle),
     SymbolDisplayGenericsOptions genericsOptions = default(SymbolDisplayGenericsOptions),
     SymbolDisplayMemberOptions memberOptions = default(SymbolDisplayMemberOptions),
     SymbolDisplayParameterOptions parameterOptions = default(SymbolDisplayParameterOptions),
     SymbolDisplayDelegateStyle delegateStyle = default(SymbolDisplayDelegateStyle),
     SymbolDisplayExtensionMethodStyle extensionMethodStyle = default(SymbolDisplayExtensionMethodStyle),
     SymbolDisplayPropertyStyle propertyStyle = default(SymbolDisplayPropertyStyle),
     SymbolDisplayLocalOptions localOptions = default(SymbolDisplayLocalOptions),
     SymbolDisplayKindOptions kindOptions = default(SymbolDisplayKindOptions),
     SymbolDisplayMiscellaneousOptions miscellaneousOptions = default(SymbolDisplayMiscellaneousOptions))
 {
     this.GlobalNamespaceStyle = globalNamespaceStyle;
     this.TypeQualificationStyle = typeQualificationStyle;
     this.GenericsOptions = genericsOptions;
     this.MemberOptions = memberOptions;
     this.ParameterOptions = parameterOptions;
     this.DelegateStyle = delegateStyle;
     this.ExtensionMethodStyle = extensionMethodStyle;
     this.PropertyStyle = propertyStyle;
     this.LocalOptions = localOptions;
     this.KindOptions = kindOptions;
     this.MiscellaneousOptions = miscellaneousOptions;
     this.CompilerInternalOptions = compilerInternalOptions;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructs a new instance of <see cref="SymbolDisplayFormat"/> accepting a variety of optional parameters.
 /// </summary>
 /// <param name="globalNamespaceStyle">
 /// The settings that determine how the global namespace is displayed.
 /// </param>
 /// <param name="typeQualificationStyle">
 /// The settings that determine how types are qualified (e.g. Nested vs Containing.Nested vs Namespace.Containing.Nested).
 /// </param>
 /// <param name="genericsOptions">
 /// The settings that determine how generics (on types and methods) should be described (i.e. the level of detail).
 /// </param>
 /// <param name="memberOptions">
 /// The settings that determine how fields, properties, events, and methods are displayed.
 /// </param>
 /// <param name="delegateStyle">
 /// The settings that determine how delegates are displayed (e.g. name vs full signature).
 /// </param>
 /// <param name="extensionMethodStyle">
 /// The settings that determine how extension methods are displayed.
 /// </param>
 /// <param name="parameterOptions">
 /// The settings that determine how parameters (of methods, properties/indexers, and delegates) are displayed.
 /// </param>
 /// <param name="propertyStyle">
 /// The settings that determine how properties are displayed. 
 /// For example, "Prop" vs "Prop { get; set; }" in C# or "Prop" vs. "ReadOnly Prop" in Visual Basic.
 /// </param>
 /// <param name="localOptions">
 /// The settings that determine how local variables are displayed.
 /// </param>
 /// <param name="kindOptions">
 /// The settings that determine which kind keywords should be included when displaying symbols.
 /// </param>
 /// <param name="miscellaneousOptions">
 /// The settings that determine other characteristics of how symbols are displayed.
 /// </param>
 public SymbolDisplayFormat(
     SymbolDisplayGlobalNamespaceStyle globalNamespaceStyle = default(SymbolDisplayGlobalNamespaceStyle),
     SymbolDisplayTypeQualificationStyle typeQualificationStyle = default(SymbolDisplayTypeQualificationStyle),
     SymbolDisplayGenericsOptions genericsOptions = default(SymbolDisplayGenericsOptions),
     SymbolDisplayMemberOptions memberOptions = default(SymbolDisplayMemberOptions),
     SymbolDisplayDelegateStyle delegateStyle = default(SymbolDisplayDelegateStyle),
     SymbolDisplayExtensionMethodStyle extensionMethodStyle = default(SymbolDisplayExtensionMethodStyle),
     SymbolDisplayParameterOptions parameterOptions = default(SymbolDisplayParameterOptions),
     SymbolDisplayPropertyStyle propertyStyle = default(SymbolDisplayPropertyStyle),
     SymbolDisplayLocalOptions localOptions = default(SymbolDisplayLocalOptions),
     SymbolDisplayKindOptions kindOptions = default(SymbolDisplayKindOptions),
     SymbolDisplayMiscellaneousOptions miscellaneousOptions = default(SymbolDisplayMiscellaneousOptions))
     : this(
         default(SymbolDisplayCompilerInternalOptions),
         globalNamespaceStyle,
         typeQualificationStyle,
         genericsOptions,
         memberOptions,
         parameterOptions,
         delegateStyle,
         extensionMethodStyle,
         propertyStyle,
         localOptions,
         kindOptions,
         miscellaneousOptions)
 {
 }