Author |
Topic |
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 01 2015 : 2:57:32 PM
|
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
|
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 |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 11 2015 : 11:37:05 AM
|
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 |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jan 13 2015 : 4:30:07 PM
|
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. |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 14 2015 : 10:53:58 AM
|
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
|
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jan 15 2015 : 6:49:00 PM
|
Good idea. I have put in a feature request for this:
case=87383 |
|
|
|
Topic |
|