Indentation in Visual Studio 2010 for C++ using Visual Assist X - visual-studio-2010

I've come acrossed something annoying about indentation in C++ (using Visual Studio 2010 and Visual Assist X).
The thing is that every time I want to start a new line after keying in ctrl+enter and ctrl+shift+enter, the cursor begins at the very beginning of a new line. This fact annoys me a lot when using the hotkeys inside any braces. For example,
for (int i = 0; i < n; i ++) {
std::cout << "say something" /* press `ctrl+shift+enter` here*/ << std::endl;
! |<--
}
After pressing the hotkey (somewhere not at the end of the line, e.g., at the comment /*...*/ above), the cursor will be at the starting position (see ! in the above code). What I want is to automatically put the cursor in the new line with the same indentation of the previous line (see |<--).
How can I make this happen? Many thanks.

Here is an answer from Whole Tomato Software Support Forum

Related

How to customize functionality of "Delete Line" hotkey in Visual Studio Community 2022?

In most IDE's I've used, including VS Code, the "Edit.LineDelete" keyboard shortcut deletes the line and tries to keep the cursor in the same place on the following line. For example, this shortcut is Ctrl+Shift+K in VS Code and Ctrl+Y in IntelliJ, and does the following:
// I've used a pipe here to represent the cursor movement...
/* BEFORE line delete */
{
...
int foo = 0; |
foo++;
}
/* AFTER line delete */
{
...
int foo = 0;
foo++;|
}
However, Visual Studio Community Edition (both 2017 and 2022) seem to have a unique way of handling this. Instead of trying to keep the cursor in the same position, it immediately sends the cursor to the very beginning of the line (even before tab spaces). See the following:
/* AFTER line delete on Visual Studio Community */
{
...
int foo = 0;
| foo++;
}
This is extremely annoying for me, as it requires extra work (mouse or End key) to get the cursor back to a useful location. I'm not even sure why they would make this work nicely in VS Code but not VS Community Edition.
Is there a way to change this functionality to mirror the behavior in VS Code or IntelliJ? I don't know of any built-in support for macros, and it seems like overkill to get an extension just for this change. Am I missing something?
NOTE: A similar question was asked here, but I'm looking to do the exact opposite.
The default shortcut is Ctrl + Shift + L
see: https://visualstudio.microsoft.com/keyboard-shortcuts.pdf

Turn off "smart semicolon" in Visual Studio C# editor

In Visual Studio 2019, it likes to try to guess where it should put the semicolon when you hit it. Often it will jump to a completely different line or insert newlines. Every time it does anything besides append it as the next character, this is extremely disruptive, and I have to go back and fix what it broke. This is akin to the disruptive "Automatic brace completion" which always puts braces where I don't want them, but can be turned off. I can't find anywhere to turn off the semicolon behavior. Is there any way to turn this feature off?
Most of the time when the semicolon misbehaves, it's because I hit it by mistake, but rather than hitting backspace, I now have a bigger mess to clean up. And I've never had a situation where it did something extra that I wanted it to do.
Some examples, with * being the cursor location:
// between a ) and ;
Foo()*;
// inserts an extra space
Foo();* ;
// before an existing semicolon:
return null*;
// moves the old semicolon to the next line:
return null;*
;
// pressing semicolon in the middle of a multi-line function call:
string path = Path.Combine(
"C:\\",
"b"*
"filename.txt");
// moves the cursor to the end of the block and inserts a "; " before ";":
string path = Path.Combine(
"C:\\",
"b"
"filename.txt");* ;
Visual Studio 16.10 adds a new configuration option to control this:
Text Editor -> C# -> Intellisense -> Automatically complete statements on semicolon
With that checked, I get the problematic behavior described in the question. When I uncheck that option, it works as it did before.

How to change Visual Studio Code's autocomplete to be the same as Visual Studio Community's?

Is there a setting that automatically inserts whitespaces into the code when you enter a semicolon?
For example,
cout<<"Hello world!"<<endl
to
cout << "Hello world!" << endl;
If you type ; in Visual Studio (as seen above), it will automatically insert whitespaces. Is there a setting similar to this in VS Code?
In Settings, under Text Editor is "Formatting". In here, turn on "Format On Type". This will cause it to auto-format after putting in a semicolon.
If it still doesn't format it after this, you'll probably have to go under Extensions to your language (which in this case is C/C++), scroll down until you see C_Cpp > Vc Format, and change any formatting you want.

move out of closing brace in visual studio shortcut

I am new to visual studio. Everytime I open a brace in visual studio the IDE automatically closes the brace.
for (int i = 0; i < n; ++i) {
int j = 2 * i; // My cursor is here right now
}
// I want my cursor here without pressing down arrow key
I don't want to press down arrow key every time I want to move out of the block. Is there any shortcut for that in visual studio. I know I can turn off this feature.
Edit 1 : I don't know why this question is marked as duplicate. In fact, the "original" question is completely different than mine. The "original" question asks how to go from opening brace to closing brace and vice versa.
Pressing } gets me out of the block.

Autoformat on custom event in Visual Studio

So currently Visual Studio will autoformat on ; so for example
int a=3
becomes
int a = 3;
but I'd like to autoformat on a custom event, such as when I smartbreak a line. Smartbreaking is by default Shift+Enter, when you break the line so that for example
int a = 3;
will stay like that even if you smart-linebreak in the middle of the statement.
Do you think this is possible? It enhances workflow significantly since my editor will often automatically add the semicolon at the end. By smartbreaking I will save a bunch of time.
This is the closest I've found:

Resources