Some people prefer usings inside namespaces. VS respects the location once it has been set, but there is no way to specify the initial behavior.
I foresee 2 options:
Pinging @AArnott and @davkean FYI
I am happy to give it a spin and implement this, but might need some pointers once I start this.
@vweijsters has built a rather impressive analyzer and code fix for this setting that we may be able to leverage. It handles pretty much everything, including preprocessor directives, comments, optional separation of groups, and sorting with or without System directives first.
Comment from @AArnott on twitter:
"I suspect both of these can be specified via .editorconfig. Getting roslyn to honor it sounds interesting. I wish I could hope item templates would somehow honor them"
Maybe it's possible to apply code formatting (CTRL K, CTRL + D) after creating a template. Then only 2 things are needed to get a zillion birds with 2 stones:
VS already formats new files from templates according to the current formatting settings, and there is work going on somewhere (@JieCarolHu?) to have that incorporate other code style items. So, someday when our code cleanup story is a little more developed, I would expect this to work for templates.
Considering that corresponding option is added in 16.1.P3, probably this one should be closed.
@sharwell @jinujoseph Can we close this if this has been fixed?
Tagging @JoeRobich
This should be fixed via https://github.com/dotnet/roslyn/pull/35009
and should be available in 16.1.Preview3 onwards.
Most helpful comment
VS already formats new files from templates according to the current formatting settings, and there is work going on somewhere (@JieCarolHu?) to have that incorporate other code style items. So, someday when our code cleanup story is a little more developed, I would expect this to work for templates.