codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Single line methods have their body pushed to the next line

Open AKruimink opened this issue 3 years ago • 4 comments

Environment

  • Visual Studio version:2022 Professional
  • CodeMaid version: 2.0
  • Code language: C#

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.

AKruimink avatar Oct 14 '22 11:10 AKruimink

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.

codecadwallader avatar Nov 10 '22 13:11 codecadwallader

any new versions?

yuessir avatar Jun 29 '23 01:06 yuessir

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.

NikoUmbleLSPA avatar Mar 21 '24 12:03 NikoUmbleLSPA

I think this project is not maintained anymore

0x55xx5 avatar Mar 21 '24 13:03 0x55xx5