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
 Enclosing {} around code reformats it :(
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

swinefeaster
Tomato Guru

310 Posts

Posted - Mar 26 2004 :  02:11:31 AM  Show Profile
The one thing I found most annoying about VS.NET is that they broke the standard TAB or SHIFT+TAB indent stuff.

I format my code like the following:


if(m_SampleSourceInfo && something &&
 somethingElse && blah && blah2 &&
 someotherstuff)
{
   // About to play.
   playing = true;

   switch(commandId)
   {
      case ID_FILE_NEW:
      case ID_FILE_OPEN:
      {
         Ui->Enable();
         break;
      }

      case ID_FILE_APPEND:
      {
         // Only enable if not read only.
         Ui->Enable(!readOnly);

         break;
      }
   }
}


Now if I want to enclose that code in {} using VAX I get this:
{
   if(m_SampleSourceInfo && something &&
      somethingElse && blah && blah2 &&
      someotherstuff)
   {
      // About to play.
      playing = true;
      
      switch(commandId)
      {
      case ID_FILE_NEW:
      case ID_FILE_OPEN:
         {
            Ui->Enable();
            break;
         }
         
      case ID_FILE_APPEND:
         {
            // Only enable if not read only.
            Ui->Enable(!readOnly);
            
            break;
         }
      }
   }
}


Ugh! Notice it added a space at the beginning of the second and third lines of my if statement and also messed up my case indentation.

In VC6, I can instead just hit TAB on that selection and then add {}s and I get the following:


{
   if(m_SampleSourceInfo && something &&
    somethingElse && blah && blah2 &&
    someotherstuff)
   {
      // About to play.
      playing = true;

      switch(commandId)
      {
         case ID_FILE_NEW:
         case ID_FILE_OPEN:
         {
            Ui->Enable();
            break;
         }

         case ID_FILE_APPEND:
         {
            // Only enable if not read only.
            Ui->Enable(!readOnly);

            break;
         }
      }
   }
}


I know it may look like nitpicking, but it's really annoying if you want to enlose bigger functions in {}s and don't want to mess up their formatting. I would like to use VAX for this, but for now I'm stuck with the old fashioned way.

Please help!

jpizzi
Tomato Guru

USA
642 Posts

Posted - Mar 28 2004 :  5:23:51 PM  Show Profile
If I understand your problem description, what you want is for the selection to not be automatically formatted when you edit it (surround it with {}). This is a selection that you can enable or disable through VA X.

Look in the VA options, under Text Editor, C/C++ (or whatever language). There is an entry there, "Format after paste." Default is enabled, but it sounds like you want it disabled.

HTH

Joe Pizzi
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 01 2004 :  7:19:56 PM  Show Profile
Nope, I have it disabled and VA X does it anyway!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Apr 02 2004 :  07:16:57 AM  Show Profile
in VS, go to:
tools -> options -> text editor -> C/C++ -> tabs
and try changing the indenting setting. it is probably set to smart. you may find that block works better for you.

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

support
Whole Tomato Software

5566 Posts

Posted - Apr 02 2004 :  12:42:45 PM  Show Profile
VA X runs automatically Format Selection after surrounding with braces. When run alone, you see it is the Format Selection that removes your spaces and indents with tabs. From what we can tell. the setting feline suggests has no effect on Format Selection.

Assuming you like your style, your only option is the "old fashioned way." Even then, we notice VS.NET removes your spaces when selecting lines and pressing Tab to indent. Perhaps we did not try all combinations of IDE options to find a way you can retain your spaces.

Although we could delve into formatting in ways more than the IDE does, we have no inclination to do it. We leave formatting styles to the IDE.

http://www.wholetomato.com/products/features/surround.html?more=yes

Whole Tomato Software, Inc.
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 06 2004 :  2:11:56 PM  Show Profile
Would it really be so hard to just insert a tab (or spaces) before every line when doing the { ? Have an option to reformat or not? Please please :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Apr 07 2004 :  10:41:19 AM  Show Profile
on my machine the selected block is still selected after the { } 's have been inserted. at this point a single press of the tab key will indent the entire selected block by one tab.

a bit of a fussy work around, but it should help for now.

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

jpizzi
Tomato Guru

USA
642 Posts

Posted - Apr 07 2004 :  10:43:45 AM  Show Profile
Personally, I would have expected the calling of Format Selection after surrounding with {} to follow the Format After Paste setting.

Joe Pizzi
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 07 2004 :  6:06:03 PM  Show Profile
feline, this doesn't help --- after the { command, the formatting of the entire block is "corrupted" already by the unwanted FormatSelection.

Tab on vc 6 never messed up your formatting, would be nice if VA X would keep to this too...
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 07 2004 :  6:06:34 PM  Show Profile
jpizzi> I agree, that's the way it should be.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Apr 07 2004 :  6:37:30 PM  Show Profile
As for feline's suggestion: What about Ctrl-Z after surrounding the selection? Does that undo the surround, or just the format?

Joe Pizzi
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Apr 07 2004 :  7:54:37 PM  Show Profile
Take a shot at Source Styler from Ochre Software. Thats another really nice add-in which has the only purpose to format your source code the way you want it. As I see it, with or without VAX you have only the choise of formatting it (ie. using the IDE's format) or not.
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 07 2004 :  9:00:32 PM  Show Profile
Holy $$$$ 300 bucks... geez... gotta check it out though, thanks for the link.

As for formatting --- yes, I was to be able to indent and add a brace *without* formatting. Just like a normal TAB in vc6 which just indents without reformatting (this was broken in vs.net), and then adding {}s. I don't need any reformatting...
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 07 2004 :  9:02:19 PM  Show Profile
jpizzi> Ctrl+Z does a step-by step undo, can't undo the formatting it seems :(.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Apr 08 2004 :  10:05:31 AM  Show Profile
using VS .NET 2003 alt_backspace un-does the format step.

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

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Apr 08 2004 :  10:08:44 AM  Show Profile
quote:
Originally posted by Uniwares

Take a shot at Source Styler from Ochre Software.


that looks very impressive, and it also looks seriously expensive for what it seems to do

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

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Apr 08 2004 :  2:52:50 PM  Show Profile
Uhm, the price is steep. But it has some really nice features for team programming. For "singles" I would recommend GC, which I personally think is the best C/C++ formatter available (after you overcome the config file ). Unfortunately it has no UI and less IDE integration.
Go to Top of Page

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 13 2004 :  4:43:46 PM  Show Profile
> using VS .NET 2003 alt_backspace un-does the format step.

Doesn't work in vc6... :(
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000