Author |
Topic |
|
klakier
New Member
Poland
4 Posts |
Posted - Jan 16 2013 : 04:26:14 AM
|
There is a fine feature in VAX >>Insert () and closing } ) ] ' " and put xxx spaces between method name and ()<<.
Would it be possible to add feature to enable automatic inserting of spaces inside these autocompleted method brackets? Typing "method(" would autocomplete it as "method( | )" with | being a cursor position. Also typing ")" in front of " )" (space and closing bracket) would just skip inserting a closing bracket and move the cursor to the right of the brackets.
Thanks -?W |
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jan 16 2013 : 7:01:26 PM
|
You can get a bit closer, by making sure the spaces are present in the VA Refactoring snippets:
Refactor Create Implementation Refactor Extract Method Refactor Encapsulate Field
so that when VA generates code via its refactoring commands, it will already be formatted how you like.
What about methods calls that don't take any parameters? Do you still want the two spaces inside the brackets then? |
zen is the art of being at one with the two'ness |
|
|
klakier
New Member
Poland
4 Posts |
Posted - Jan 17 2013 : 06:58:29 AM
|
Thanks for pointing out the refactoring snippets, I will surely take a look at what can I do with them.
In the case of methods / method calls with no arguments I tend to skip the spaces and just type the brackets alone. I can see how this can be a complication to my idea but the spaces could be simply removed if ")" was pressed with no arguments between brackets. I also usually compress closing brackets in nested calls to something like this:
ret = method( arg1, arg2, anotherMethod( arg31, arg32 ));
just to make it more readable, conserve horizontal space and ease counting closing brackets in case something got messed up. But this may not be that easy to implement so it can be used intuitively, so it could be just omitted.
I should add I usually apply the same rules to <> and [] brackets, but in these cases it may not always be so obvious, because readability of constructions using these brackets may vary greatly, especially with nested use. |
Edited by - klakier on Jan 17 2013 06:59:18 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jan 18 2013 : 11:19:36 AM
|
Unfortunately you are now moving away from a simple "always do this" rule, and this is turning into code formatting, according to your personal style. We don't have any current plans to try and do code formatting, since everyone who wants this wants something different. You might want to look at this tool, which sounds interesting:
http://www.profactor.co.uk/stylemanager.php
Alternatively VS2010 offers some code formatting settings for C#, in
IDE tools menu -> Options -> Text Editor -> C# -> Formatting -> Spacing
|
zen is the art of being at one with the two'ness |
|
|
klakier
New Member
Poland
4 Posts |
Posted - Jan 18 2013 : 11:24:32 AM
|
As I said any complications could be simply ommited as inserting spaces within brackets is the most important part of my suggestion and anything more than that is just my personal quirk, which I understand that is not very common ;)
Thanks for the link, from what I see I really must check it out! |
Edited by - klakier on Jan 18 2013 11:29:50 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jan 18 2013 : 5:28:45 PM
|
It turns out there is already a registry key setting to do this, I have added a FAQ entry for it:
http://docs.wholetomato.com?W335
This should help For the more detailed code formatting, a specific code formatting tool will probably help more. |
zen is the art of being at one with the two'ness |
|
|
klakier
New Member
Poland
4 Posts |
Posted - Jan 21 2013 : 04:11:12 AM
|
Thanks for the tip. It does almost what I need, but places the cursor just in front of the last character instead of in the middle (e.g. "( |)" ). Is there and option to change that? This would be exactly what I need :) |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jan 21 2013 : 11:58:48 AM
|
Unfortunately there is no option to change this yet, but I noted the same problem myself, and it is on our list of things to fix:
case=64684 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|