Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Auto format after inserting closing bracket
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mspa
Senior Member

Netherlands
44 Posts

Posted - Sep 18 2007 :  06:12:32 AM  Show Profile  Reply with Quote
Using VAX 1549 with VS2005

There is a VAX option to auto format code (using IDE formatting) after pasting a piece of code ('Format after paste' in the correction options). This is also wanted behaviour for the option to insert the closing bracket of i.e. 'if' statements.

For example, I have my IDE settings to auto format an 'if' statement to include spaces after the opening and before the closing parenthesis.

So when typing:
if(expression)
{
   
}

after typing the closing bracket, the IDE will auto format it to:
if ( expression )
{
   
}


If I try the same with the VAX option to insert the closing bracket for me when I create an 'if' statement, I end up with an unformatted statement.

So the IDE triggers an auto format on typing a closing bracket but because VAX now inserts the bracket for me, the auto formatting is ignored.

Any possibility to call the IDE auto format for this option?

Old as dirt
Tomato Guru

USA
246 Posts

Posted - Sep 18 2007 :  09:43:51 AM  Show Profile  Reply with Quote
This may not be the question you asked, but you can edit the autotext for "if" so that it formats it just like you want and you don't even have to type the closing brace.
You get to the autotext editor through VAssist Options/Advanced/Suggestions.

Ken
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - Sep 18 2007 :  11:26:33 AM  Show Profile  Reply with Quote
Autotext, as Old as dirt suggests is the best solution here.

We try to avoid getting into code formatting questions if possible, since everyone has their own views and standards. Autotext entries leave everyone free to apply their own preferred formatting to these code blocks.

http://www.wholetomato.com/products/features/autotext.asp

zen is the art of being at one with the two'ness
Go to Top of Page

mspa
Senior Member

Netherlands
44 Posts

Posted - Sep 19 2007 :  05:52:58 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

since everyone has their own views and standards.



Well that is exactly what I mean. I have already defined my personal standard in the IDE (VS2005) formatting rules. These rules are automatically applied by the IDE when I close a statement with a ';' character or in this case type the closing bracket of an 'if' statement.

I want to use my personal defined rules also when VAX inserts this closing bracket for me just like the VAX option to apply the IDE formatting rules after a paste, I don't see any problems with VAX applying these same rules after inserting the closing bracket because it is already done in another VAX feature.

Like I said, I already defined my personal formatting rules in the IDE settings. The last thing I want is also define these same rules in the 'autotext', which I don't even use now ;)
Go to Top of Page

bugfix
Tomato Guru

Germany
324 Posts

Posted - Sep 19 2007 :  06:25:02 AM  Show Profile  Reply with Quote
always applying ide formatting after vax actions is not the best idea imho.
see here for at least one reason: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=5759

are you coding in c#? cause i couldn't find any of such formatting configuration options in vs2005 for c++.

http://www.mf-sd.de
Go to Top of Page

mspa
Senior Member

Netherlands
44 Posts

Posted - Sep 19 2007 :  06:54:18 AM  Show Profile  Reply with Quote
But in that case you are using a VAX autotext, which ofcourse shouldn't be formatted again by the IDE because it already has it's own formatting. I am typing the 'if' statement 'manualy' without any autotext. As I see it now VAX actually breaks the functionality of the IDE to format code after typing a closing bracket.

And yes I am coding in c# ;)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - Sep 19 2007 :  09:35:32 AM  Show Profile  Reply with Quote
First a general answer. Nearly every other post about code formatting boils down to "I hate the IDE formatting, I want VA to do something completely different". This makes sense when you check out the IDE's C++ code formatting options. Basically none. But it is also asking for a LOT of work from VA.

C# actually has some code formatting options, so it is a slightly different case.

Looking at VS2005 C# formatting options the key settings seem to be to format on semi-colon and to format on typing a closing curly bracket.

However it also has formatting options for placing keywords (else, catch), the placement of opening braces, and various other things.

I gave up arguing with the IDE over code formatting a few years ago, and just accept the defaults these days, so I am not familiar with how C# code formatting behaves, I have never experimented with it.

I am trying to work out the scope of things here. What about accepting listboxes when typing keywords? What about having VA insert closing brackets?

You say you don't use VA's autotext, but do you ever use VA's refactoring features? The code formatting you get when using VA's refactoring is determined by the refactoring autotext entries.

And a practical question, why do you type:

if() {

when it would be quicker to type if and accept the autotext suggestion? Or is this simply habit?

zen is the art of being at one with the two'ness
Go to Top of Page

mspa
Senior Member

Netherlands
44 Posts

Posted - Sep 20 2007 :  03:57:19 AM  Show Profile  Reply with Quote
Ofcourse it's just a habit I have but thats the way I work. For refactoring I use the VS2005 feature instead of the VAX feature so I really never use the autotext.

But I guess this is the first 'I love the IDE formatting' topic

I'm not saying that VAX should autoformat the text using the IDE formatting after each feature but at least consider doing it for inserting the closing bracket, which is already an option for the IDE. This is also, as far as I know, the only VAX feature that breaks the IDE formatting.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - Sep 20 2007 :  11:36:52 AM  Show Profile  Reply with Quote
A reasonable point. I have put in a feature request for this:

case=8971

For now you may find learning to use the autotext items helps. I know it is not the same, but it does save you typing, once you get used to them, and less typing is good

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Sep 20 2010 :  10:14:05 PM  Show Profile  Reply with Quote
case=8971 is fixed in build 1832

Whole Tomato Software, Inc.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000