Home > Net >  Visual Studio doesn't put space in between 'internalclass' due to EditorConfig
Visual Studio doesn't put space in between 'internalclass' due to EditorConfig

Time:03-26

When I create a new class using Visual Studio, it produces the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test;
internalclass Test
{
}

The issue is that there is no space between internal and class, which I want to fix. It is caused by csharp_style_namespace_declarations = file_scoped and Visual Studio itself. I disabled ReSharper and it was the same.

Tools:

  • Visual Studio 2022 - latest update
  • ReSharper 2021.3.3 built on 2022-01-25

.editorconfig

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{csproj,json,md,nuspec,yml}]
indent_size = 2

[*.{sln,xml}]
indent_style = tab

[*.cs]
csharp_style_namespace_declarations = file_scoped

CodePudding user response:

This is a known issue in Visual Studio. It has been fixed, and the fix should be included in the next Visual Studio release.

  • Related