Author |
Topic |
|
Tomas
New Member
Czech Republic
3 Posts |
Posted - Mar 14 2014 : 4:42:11 PM
|
Hi,
I have a nice feature in mind that might be really useful for clarity of source code. You probably all know the formating style, where you nicely indent everything like this:
void...............F(); static const int...YesIAmReallyLongAndThereforeCool();
int................p;
(. is suppose to be space and all the names are suppose to be indented to the same level).
I think that this is a bad idea if you have to do this manually because it can be hard to maintain. I actually tried to use this style a long time ago, but didn't really like it because of this very reason. Recently I started to work on project that used it and I have to say that reading this source code is MUCH clearer.
It seems to me that it would be rather easy to add this feature since you can already indentify what is variable and what is method so you would only need to add a few tabs before them.
Plus it might be handy to have a few options (how much space is needed etc.). |
Edited by - Tomas on Mar 14 2014 4:47:31 PM |
|
feline
Whole Tomato Software
United Kingdom
18995 Posts |
Posted - Mar 17 2014 : 1:12:51 PM
|
Unfortunately we don't have any current plans to get involved in code formatting, since doing this properly requires a lot of different settings and options, since everyone has their own style and views on proper code formatting.
If your IDE has IDE macros, have a look at:
IDE Tools menu -> Macros -> Macro Explorer
and the IDE macro:
Macros -> Samples -> VSEditor -> LineEmUp
I have not used this macro, but the comment description makes it sound useful for this.
Alternatively you might want to consider a third-party extension or external program, e.g. GC GreatCode, Uncrustify, and StyleManager. |
zen is the art of being at one with the two'ness |
|
|
Tomas
New Member
Czech Republic
3 Posts |
Posted - Mar 17 2014 : 3:56:20 PM
|
Thank you for the response.
I never thought you would go for complete formatting. Visual Studio 2013 has one, but can't do this "alignment" I mentioned. Normal automatic formating is not that important IMO because it is not a problem to format your code (it can be useful for reformatting though).
"Alignment formating" is important and is not suppose to change formating style (just insert appropriate numbers of tabs/spaces). So you really wouldn't have to create automatic formating with all the options. Just check box "align members in class" and perhaps "extra tabs" (number of additional tabs). That would do the trick.
I will definitely check out those programs, but direct support from MSVC or Visual Assist would be nice :-) |
|
|
feline
Whole Tomato Software
United Kingdom
18995 Posts |
Posted - Mar 18 2014 : 3:49:32 PM
|
Alignment formatting is still a type of code formatting, and is not always as simple as it sounds. This has been discussed before, and you quickly encounter two edge cases. Firstly very long types, which can happen when working with template classes. Secondly, medium indenting to align can push you past the preferred line limit.
So even here this is not always as simple as a single check box.
Since you are using VS2013 you might want to look into this IDE extension for enabling macros in the IDE:
http://visualstudiogallery.msdn.microsoft.com/deda8ac1-75e6-4068-89ab-b607cee38f2d
I have not used this personally, but it does look very helpful. If you are interested I can post the sample IDE macro for aligning variables, so you can give it a go. |
zen is the art of being at one with the two'ness |
|
|
Tomas
New Member
Czech Republic
3 Posts |
Posted - Mar 19 2014 : 1:26:34 PM
|
Yes, if those cases has to be handled by the program then it is more complex. I actually assumed that programmer will write reasonable code and will not create super-long return types (use typedefs and stuff).
Anyway, thank you for your suggestions!
PS: It might be possible that this will be available in the Visual Studio. |
|
|
|
Topic |
|