codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

Single line methods have their body pushed to the next line #952

Open AKruimink opened 1 year ago

AKruimink commented 1 year ago

Environment

Description

Default settings of codemaid, have the foillowing method image

Run code cleanup, and have the brackets + return moved to the next line image

Not only do I not want it to move it, it also seems to format it very oddly by leaving the brackets and return on the same line.

Steps to recreate

  1. Create a new project
  2. Create a single line method as shown above
  3. Run code cleanup, the body gets pushed to the next line.

Current behavior

It pushes the body to a single line below the method name.

Expected behavior

I'm expecting it to not push the code to the next line at all, and if it does, that it alteast ensures that its formatted correctly by having the brackets and content all on seperate lines.

codecadwallader commented 1 year ago

Thanks for reporting the issue. I have been able to reproduce it. It appears to fall under the bucket of issues caused by a breaking change to the VS SDK related to access modifiers. If you disable "Insert explicit access modifiers on methods" it behaves as expected (return statement and braces all on their own line). Link to #879 for more details on the root SDK issue.

yuessir commented 1 year ago

any new versions?

NikoUmbleLSPA commented 5 months ago

I'm definitely seeing this one myself, though this is just with using snippets. I swear it worked fine at first, but now it's definitely adding extra lines. I feel like it may have something to do with Visual Studio's snippet implementation, if that's what codemaid is leveraging. It's also interesting in that I have a class skeleton template that I use that does not have this issue. Maybe that advises some direction here.

0x55xx5 commented 5 months ago

I think this project is not maintained anymore