This code refactoring extension provides quick actions for automatically wrapping and formatting various code elements, such as constructor and method declarations.
This is an extension to enable 'Quick Actions' for automatically wrapping and formatting long lines of code.
So far I've only found this functionality in that other extension that people are always evangelizing - you know the one. I don't want that thing, so I am working on a replacement for this part of it.
Initial Release. Supported Features:
Generate Constructor: generates a constructor, with automatic wrapping/indentation of parameters if the declaration would be too long. If there are generic type arguments, and the declaration plus generic argument list is too long, it wraps the generic params as well. If there are generic constraint clauses, these are wrapped.
Wrap Method Declaration: wraps/formats an existing method declaration. Same functionality as above regarding generics.
Wrap Method Call: wraps/formats an existing method call. Same functionality as above regarding generics.
Recursive Option: if any method call parameters happen to be method calls or constructor calls, a 'Recursive' Quick Action will be added.
The quick action applies to whichever call the cursor is on, so in the 'recursive' case you can still individually format the arguments which are themselves method/constructor calls.
Wrap Constructor Call: same as method calls above.
Notes
a "too long" line is currently hard-coded as 160 characters
Tabs vs spaces -> currently hard-coded as spaces, but tries to detect tabs for finding the indentation level.
Known Issues
Linqy stuff probably won't be detected as a method call.
Method calls on the result of another method call -> it will only detect the last method call. Example: a.Test(a, b, c).Test(x, y, x). Only x, y, z will be wrapped.
Future Planned Features:
Fix the above known issues
support recursion on generic arguments
better error handling + error reporting maybe
user settings for
"too long" line length
whether to auto-recurse if any wrapped line is still too long