Skip to content

Update SymbolDisplay to include scoped for parameters and locals #63208

@cston

Description

@cston

Background and Motivation

Include scoped modifier for parameter and local types from SymbolDisplay.

Proposed API

For SymbolDisplayLocalOptions, the IncludeRef option is extended to include scoped, and a new IncludeRefAndScoped option with the same value is added.

For SymbolDisplayParameterOptions, the IncludeParamsRefOut option is extended to include scoped, and a new IncludeParamsRefOutScoped option with the same value is added.

namespace Microsoft.CodeAnalysis
{
    [Flags]
    public enum SymbolDisplayLocalOptions
    {
        // ...

        /// <summary>
-       /// Includes the <c>ref</c> keyword for ref-locals.
+       /// Includes the <c>ref</c> keyword for ref-locals and the <c>scoped</c> keyword for scoped locals.
        /// Replaced by <see cref="IncludeRefAndScoped"/>.
        /// </summary>
        IncludeRef = 1 << 2,

+       /// <summary>
+       /// Includes the <c>ref</c> keyword for ref-locals and the <c>scoped</c> keyword for scoped locals.
+       /// </summary>
+       IncludeRefAndScoped = 1 << 2,

    }

    [Flags]
    public enum SymbolDisplayParameterOptions
    {
        // ...

        /// <summary>
-       /// Includes the <c>params</c>, <c>ref</c>, <c>in</c>, <c>out</c>, <c>ByRef</c>, <c>ByVal</c> keywords before parameters.
+       /// Includes the <c>params</c>, <c>scoped</c>, <c>ref</c>, <c>in</c>, <c>out</c>, <c>ByRef</c>, <c>ByVal</c> keywords before parameters.
        /// Replaced by <see cref="IncludeParamsRefOutScoped"/>.
        /// </summary>
        IncludeParamsRefOut = 1 << 1,

+       /// <summary>
+       /// Includes the <c>params</c>, <c>scoped</c>, <c>ref</c>, <c>in</c>, <c>out</c>, <c>ByRef</c>, <c>ByVal</c> keywords before parameters.
+       /// </summary>
+       IncludeParamsRefOutScoped = 1 << 1,
    }
}

Usage Examples

// some lines of code here

Alternative Designs

Risks


Separated out from #61647. See #61647 (comment) that should be addressed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions