-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support more .editorconfig code styles #40
Comments
Hi, thank you so much for building this tool. It is really helpful. But I see the same behavior. In the .editorconfig I have the settings: dotnet_style_require_accessibility_modifiers = always and it works if I use the code format option in Visual Studio (CTRL+E, D). |
@Zonnex or @dotnetgeek could you post a link to your projects or at least the entire |
This branch took this editorconfig and changed it to use these settings to try enforce types, but no files are changed when I run dotnet-format on the solution.
|
@Zonnex can you point me to the actual code you are trying to format? |
For instance, with those options set to false, I would expect line 44 and 45 in this document to have types instead of 'var' keyword. I was digging around in roslyn code, and my guess why this isn't working is because these options are internal and not used here |
Here is my current editorconfig https://gist.github.com/dotnetgeek/f175091779c9a9552fe9046f16457568 |
For @dotnetgeek's issue, I found that this class contains "dotnet_style_require_accessibility_modifiers", but that specific option is internal and as such is not exposed. However I'd expect that csharp_preserve_single_line_statements which is public here named WrappingKeepStatementsOnSingleLine to work |
Hi everyone, Thanks for the enthusiasm! Currently dotnet format is the equivalent of running the 'Format Document' command in Visual Studio, which supports whitespace formatting. Our goal is to support more of the code cleanup scenarios in the future. |
I have added a wiki page that lists the currently supported .editorconfig options https://github.com/dotnet/format/wiki/Supported-.editorconfig-options |
It would be great if more scenarios were supported! |
@JoeRobich is the development to support more scenarios open to contributions here on GitHub? |
Sorting or grouping using statements also doesn't appear to work. They are controllable via:
|
@challen0 Supporting the Roslyn analyzers and fixes for the other code styles is work that we want to do ourselves. Thanks for the offer =) |
Would love this feature |
Would love to see support for these as well:
We have a ton of code from before .editorconfig was a thing, and when we do changes there we frequently get noise in the diffs when final newline is added, or UTF-8 BOM is removed. Fixing all those in one go would be really nice. |
@runehalfdan Support for Thanks for reminding me to update the supported options wiki page. =) |
Closing this issue now that the core .editorconfig properties are supported. CodeStyle analyzer support is being tracked at #416 |
I was quite happy when I stumbled across this article by Scott Hanselman, I installed dotnet-format globally and ran it. However it does not apply all rules, and I can't figure out if I'm missing something or if it's not intended to do so.
For example, it cleaned out some trailing whitespace which was great and moved curly braces to new lines.
It did not apply any rules regarding var vs types. Is this intended to be skipped, and if so is it planned to be supported?
The text was updated successfully, but these errors were encountered: