visual studio – How to edit the default indentation for #nullable


When I disable the nullable reference types in specific parts of my code, then the #nullable disable and #nullable restore are not indented as I expect it. This is what I currently receive:

#nullable disable
    var options = new ScraperExcelListoneColumnNamesOptions
    {
        PlayerId = null,
        RoleCode = "",
        PlayerName = " ",
        TeamName = null
    };
#nullable restore

I would like them to be indented like this (as it would be when working with #region.

    #nullable disable
    var options = new ScraperExcelListoneColumnNamesOptions
    {
        PlayerId = null,
        RoleCode = "",
        PlayerName = " ",
        TeamName = null
    };
    #nullable restore

Is there a place to edit this setting in Visual Studio? Of course I could indent them manually, but

  1. It would be annoying
  2. If I format the entire document with Visual Studio using Ctrl+K and Ctrl+D it would set back the originary formatting.

Leave a Reply

Your email address will not be published. Required fields are marked *