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
 Feature Requests
 Change Background for blocks into blocks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hoiby
Senior Member

France
38 Posts

Posted - Dec 13 2006 :  10:48:57 AM  Show Profile  Reply with Quote
Often, I make some mistakes like:

if (...)
  doThis();
  doThat();
doThatToo();

or

main (){
  if (...){
   DoThis();
   DoThat();
}

or

if (......................................) DoThis();
{
  DoThat();
}


For a long time I have been looking for an editor that distinguishes the blocks's content, to quickly correct mistakes.

Here is a picture showing, a kind of visual solution.
 

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Dec 13 2006 :  12:13:45 PM  Show Profile  Reply with Quote
This is where auto indent can be very useful. As soon as the indenting starts doing something unexpected, you are aware the code is not what you think it should be.

Changing the background colour is a *hard* thing for VA to do, since it does not have full control, so it is unlikely we will ever try to offer this. Plus this idea runs into a problem when you are 6, 8, or 20 blocks deep inside a function. This does happen.

In VS2003, VS2005 there is the outlining feature, this gives you visual feedback on the blocks.

To try and stop this happening in the first place try using autotext more often, so it will insert all of the brackets for you as you type the initial if statement.

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

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - Dec 14 2006 :  04:04:05 AM  Show Profile  Reply with Quote
Talking about auto-indenting: I discovered a case where auto-indenting doesn't work properly. Not sure whether this is an issue of the IDE or VAX (I presume the former).

Here's an example:


class cMyClass
{
private:
   int m_myInt;
public:
   cMyClass(int someInt)
       : m_myInt(someInt) {}
       int get () const { return m_myInt; }
};


The problem here is the member initialization on a new line followed by an empty function body on the same line. If you put everything on the same line, it works. If you put the function body on a new line as well, it works. If you leave it like presented above, the next line (and any code following that up to the closing bracket of the class) will be indented one step too deep.

P.S.: While the above is hardly related to the topic, I thought of something else that is:
Recognizing the start and end of blocks can get tricky when using #define macros with unmatched brackets. The same goes for macros hiding 'if', 'for' or 'while' statements. (the all-time favorite MIN and MAX macros come to mind...)

Edited by - sl@sh on Dec 14 2006 04:12:04 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Dec 14 2006 :  09:23:04 AM  Show Profile  Reply with Quote
the indenting problem, this is definitely the IDE. To prove this take the code, mess up the formatting, then select the code and trigger the IDE's format code option CTRL-K, CTRL-F by default in VS2003, you get exactly the same end result. VA stays well away from the whole "how to format my code" question.

To build on your #define point, what about people who use #define's for the start and end of namespaces, or wrap curly brackets in #if #endif blocks?

As you say, this is not as simple as it sounds.

zen is the art of being at one with the two'ness
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