vscode-csharp
vscode-csharp copied to clipboard
Is dotnet_style_parentheses_* supported?
I can't seem to get it to work with Omnisharp in VSCode.
My .editorconfig file is working, as I can disable rules normally. The lines
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
however, seem to not have any effect.
Is setting these values supported?
Code style rules require omnisharp.enableRoslynAnalyzers be enabled. To change the severity of these analyzers you would need to also configure IDE0047 & IDE0048. See the docs.
Example making them warnings:
root = true
[*.{cs,vb}]
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_diagnostic.IDE0047.severity = warning
dotnet_diagnostic.IDE0048.severity = warning
Thanks for the quick response @JoeRobich !
I did double check the things you mentioned and could not find any issue, yet the dotnet_style options are still not working for me :(
My .editorconfig file is here for reference.
I did try both including the :warning suffix (as in always_for_clarity:warning) and not. Neither seems to work.
Enabling IDE0047 and IDE0048 specifically should not be necessary as I have enabled all rules by default, and I do get the warning from IDE0047 when I do use parenthesis for clarity (such as in (a / b) * (c + d)).