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
 C++ Directive alignment
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Millianz
Junior Member

10 Posts

Posted - Jun 17 2011 :  9:11:06 PM  Show Profile  Reply with Quote
Hello,

This has been bugging me for a while and I'm not really sure whether this is Visual Studio or Visual Assist X behavior.

Basically every time you attempt to align #define or any other c++ directives using indentation with tabs or spaces, something moves the directive back to the beginning of the line.

I like to have defines the following way


#ifdef _MSC_VER
# define Break() __debugbreak()
#else
# define Break() do { __asm int 3 } while(0)
#endif


which is hard since VAX isn't keeping track of my current indentation.

Millianz
Junior Member

10 Posts

Posted - Jun 17 2011 :  9:13:29 PM  Show Profile  Reply with Quote
Another unrelated feature that would be nice (and maybe could be accomplished using VA snippets) would be to automatically comment the closing curly braces of namespaces with the namespace name, i.e:


namespace Foo
{

} // namespace Foo
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 17 2011 :  10:56:50 PM  Show Profile  Reply with Quote
First question,
I don't really understand your question. If I select the lines and press tab, they will move and stays there. If I copy-paste them somewhere else, Visual Assist asks Visual Studio to format the selection which makes them move to the begging of the line. This can be turned off:

VA Options -> Advanced -> Correction -> Format after paste

Second question,
Yes, a snippet can be used. Just create the following snippet with shortcut "namespace", "ns" or whatever you like and paste the following line to last editbox of the snippet editor:
namespace $givenname$
{

} // $givenname$

This way, when you type your shortcut (i.e. ns) and then press enter, you will be prompted to type the name, e.g. Foo, so you will get what you wanted. Hope this helps :)
Go to Top of Page

Millianz
Junior Member

10 Posts

Posted - Jun 18 2011 :  5:24:41 PM  Show Profile  Reply with Quote
Hi,

Thanks for the answer, the namespace snippet works nicely.

Regarding the directive alignment, let me rephrase that a little bit.
The problem I'm having with directives is that they are auto formatted to always be at the beginning of the line.

Consider the following:

If I type something like

#if _DEBUG

and then hit enter and then tab (to indent):

#if _DEBUG
  |

and then type the pound symbol to write a second directive

#if _DEBUG
#....

something moves the entire line to the very beginning. I'm not sure if it's visual studio or visual assist x, but it becomes annoying quickly in larger files, for example if an entire code section is guarded from being included in release (debug methods, additional checks, asserts,....). An example of this would be


namespace Foo
{
  namespace Bar
  {
    Release code
    .
    .
    .
    #if _DEBUG

      void DumpBlocksInUse(void)
      {
        #if MEMORY_STATISTICS // Every time I type a new directive it is moved to the beginning of the line (try it)
          ...
        #else
          ...
        #endif
      }

    #endif
  }
}


I definitely don't think this issue deserves high priority in any way, BUT it is really annoying if you are working with a lot of pre processor directives.

--Mill
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 20 2011 :  7:17:26 PM  Show Profile  Reply with Quote
*ah* Now I see what you mean
This is definitely a Visual Studio behavior, it happens even when I disable VA via the extension manager:

Tools -> Extension Manager...

I took a quick glance at the text editor options in Visual Studio's option dialog but no luck. It doesn't mean you cannot turn it off somehow, though.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 21 2011 :  10:03:04 AM  Show Profile  Reply with Quote
You might want to look into a tool specifically designed to do code formatting / indenting. One commercial program is: http://www.profactor.co.uk/stylemanager.php

Personally I have never used this tool, but it sounds promising from the website description.

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

Millianz
Junior Member

10 Posts

Posted - Jun 22 2011 :  5:59:27 PM  Show Profile  Reply with Quote
I figured that it would be something visual studio does, too bad :(

That tool actually looks pretty cool, I'll give it a test run as soon as I have time for playing around with it :P

Thanks for the help guys.
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