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
 #define not out-denting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

foxmuldr
Tomato Guru

USA
416 Posts

Posted - Jan 01 2015 :  2:57:32 PM  Show Profile  Reply with Quote
There are times I have a series of #define statements indented under some title so as to make it easy to read for the eye, as in:

//////////
// Widget Error codes
//////
    #define _WIDGET_ERROR_MEMORY       1
    #define _WIDGET_ERROR_ACCESS       2
    #define _WIDGET_ERROR_INPUT        3

Whenever I go to type a new line, VS or VAX always left-justifies the #define statement, bringing it to the left-most margin at column 0.

I would like an option to prevent that, or to turn that auto-fixup off. Thank you. :-)

Best regards,
Rick C. Hodgin

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 07 2015 :  12:29:27 PM  Show Profile  Reply with Quote
This is done by Visual Studio, not Visual Assist.

I have tried to figure out how to disable this, but wasn't able to find to solution so far. There should be a formatting setting in Visual Studio 2013:

Tools -> Options... -> Text Editor -> C/C++ -> Formatting

I didn't find one here or anywhere else or on the net.

Edited by - accord on Jan 07 2015 12:29:50 PM
Go to Top of Page

foxmuldr
Tomato Guru

USA
416 Posts

Posted - Jan 11 2015 :  11:37:05 AM  Show Profile  Reply with Quote
Alright ... instead of working explicitly with #define, could a keystroke like Alt+Shift+I be added to automatically indent or out-dent the current line (or block of code) so it is horizontally aligned with the code immediately above (like the way VAX does now when you paste a block of code to a new area)?

Best regards,
Rick C. Hodgin

Edited by - foxmuldr on Jan 12 2015 10:52:50 AM
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 13 2015 :  4:30:07 PM  Show Profile  Reply with Quote
When you paste code, Visual Assist applies Visual Studio's formatting. The problem here is that Visual Studio's formatting decides that the #define should go to the first column. If you copy-paste a code with a #define in it, you'll see the same effect: the #define will be moved.
Go to Top of Page

foxmuldr
Tomato Guru

USA
416 Posts

Posted - Jan 14 2015 :  10:53:58 AM  Show Profile  Reply with Quote
quote:
Originally posted by accord

When you paste code, Visual Assist applies Visual Studio's formatting. The problem here is that Visual Studio's formatting decides that the #define should go to the first column. If you copy-paste a code with a #define in it, you'll see the same effect: the #define will be moved.



For the Alt+Shift+I keystroke, VAX could parse the line (or block if multiple lines are selected) and if all are prefixed with "#", then remove that character from each line, apply the Visual Studio formatting, and then programmatically insert it back in to each line after it's reformatted. The original horizontal offset into the line could also be maintained by noting the indentation before, and after, and adding it in to the horizontal value.

Or, you could iterate north in the source code file to find the first non-blank line above and align with whatever's there. I you find a line that ends in {, then indent the line one more than it is already aligned, otherwise align it as it is.

Best regards,
Rick C. Hodgin
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 15 2015 :  6:49:00 PM  Show Profile  Reply with Quote
Good idea. I have put in a feature request for this:

case=87383
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