-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add new line to C# item templates with file-scoped namespaces #30955
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
Conversation
|
@baronfel do you have an opinion on this? the change looks for better to me. |
|
Yes, this LGTM. |
vlada-shubina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
@YuliiaKovalova let's backport it to 7.0.3xx too. |
|
Question from me: Will this affect item templates in Visual Studio? Does it use template engine from this repo? |
|
It might be good idea to make the same change in project templates as well: https://github.com/dotnet/sdk/tree/8af67162055b50507b5b8743d199828a144275b9/template_feed/Microsoft.DotNet.Common.ProjectTemplates.8.0/content Long run solution: dotnet/templating#5505 |
Unfortunately not in the current version (VS uses |
The was a discussion about it, but we faced an ambiguity between these project items and already existing ones in VS. |
@GangWang01 , could you add these changes? |
@YuliiaKovalova Sure. Made the change in #30972 and #30973. |
This is on the backlog, but we don’t have a planned release as of yet for the new templates. |
|
Can this be merged? Also if you plan to backport this change to 7.0.3, I assume you'll do it yourselves, right? |
Yes, we will port it. Thank you for your contribution! |
|
you're claiming that this was merged almost year ago, but the problem still persists |
|
Unfortunatelly, there are 2 different template engines in .NET CLI and VS. This PR applies to .NET CLI (e.g. |
|
I just noticed that the Visual Studio template actually uses a block scope namespace by default: So, it appears that the fixup is being applied by Roslyn after the template's creation does not inject an extra space. Although, this does work as expected with ASP.NET Core projects. I wonder if the fixup is being applied differently between ASP.NET Core and non ASP.NET Core C# projects. |
Fixes: dotnet/roslyn#65921(Does not fix that issue)Started a new project recently and it was extreamly annoying to add that additional line every single time I create an item. In all codebases I've seen there is always a line break between namespace and type declaration