vscode-csharp
vscode-csharp copied to clipboard
dotnet_style_namespace_match_folder support
As far as I understand the dotnet_style_namespace_match_folder rule is not supported by omnisharp. At least at the moment it doesn't fire any warnings even though the IDE0055 rule is turned on (https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules). Is it possible to make it work?
Just encountered this behavior! This would be an awesome addition :pray:
You can configure the severity of this analyzer by adjusting the IDE0130 diagnostic.
Example .editorconfig:
root = true
[*.cs]
dotnet_diagnostic.IDE0130.severity = warning
CC: @ryzngard
Hi @JoeRobich :pray: thanks, this works like a charm
Hi, I am not sure if I am at the right place... totally new to C# linting.
If I understood correctly, setting the severity was supposed to make it work, but I can't seem to get dotnet_style_namespace_match_folder
to work on my VS Code, and this made me find this issue.
I am using the C# extensions recommended by VS Code and I have this .editorconfig:
root = true
[*.cs]
dotnet_diagnostic.IDE0130.severity = warning
dotnet_style_namespace_match_folder=true
my .csproj also has these settings:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<RootNamespace>Test</RootNamespace>
</PropertyGroup>
<ItemGroup>
<CompilerVisibleProperty Include="RootNamespace" />
<CompilerVisibleProperty Include="ProjectDir" />
</ItemGroup>
</Project>
I get no warning nor error (trying to change the diagnostic to "error" makes no difference)
If I run the dotnet format command (which if I understood correctly should give the same result), it does give me a warning:
dotnet format .\MyProj.csproj style --verify-no-changes
Program.cs(3,11): warning IDE0130: Namespace "AAbc" does not match folder structure, expected "Test" [[ommited]\MyProj.csproj
Edit: I forgot to mention that other style checks does work in my VS Code. folder matching is the only one that I noticed that doesn't work at all.