Skip to content

Disable dotnet-format for a section of the code via comments or preprocessor directives #782

@siegfriedpammer

Description

@siegfriedpammer

It would be nice to be able to turn off dotnet-format for a section of lines via line comments, similar to what clang-format offers: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code

This comes in handy, if you have unit tests that test C# code and the generator of said code is not Roslyn or does not understand .editorconfig.

Real world use-case: see the diff snippet in icsharpcode/ILSpy#2128 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions