Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RCS0053 - Formatting issues #1517

@prezaei

Description

@prezaei

Product and Version Used:

<PackageVersion Include="Roslynator.Analyzers" Version="4.12.5" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.5" />

Steps to Reproduce:
Visual Studio and VS Code default formatting (CTRL+K+D on Windows in VS) format the following file differently.

internal sealed class Test
{
    public static TiktokenTokenizer CreateTokenizer(TokenizerEncoding encoding) =>
        TiktokenTokenizer.CreateForEncoding(encoding switch
        {
            TokenizerEncoding.Cl100kBase => "cl100k_base",
            TokenizerEncoding.O200kBase => "o200k_base",
            _ => throw new Exception("Invalid encoding")
        });
}

Actual Behavior:
RCS0053 formats it this way

internal sealed class Test
{
    public static TiktokenTokenizer CreateTokenizer(TokenizerEncoding encoding) =>
        TiktokenTokenizer.CreateForEncoding(encoding switch
            {
                TokenizerEncoding.Cl100kBase => "cl100k_base",
                TokenizerEncoding.O200kBase => "o200k_base",
                _ => throw new Exception("Invalid encoding")
            });
}

<img width="613" alt="image" src="https://github.com/user-attachments/assets/506bdb4e-be5d-4947-8e2f-d41e03e06197">

Expected Behavior:

internal sealed class Test
{
    public static TiktokenTokenizer CreateTokenizer(TokenizerEncoding encoding) =>
        TiktokenTokenizer.CreateForEncoding(encoding switch
        {
            TokenizerEncoding.Cl100kBase => "cl100k_base",
            TokenizerEncoding.O200kBase => "o200k_base",
            _ => throw new Exception("Invalid encoding")
        });
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions